Skip to content
a-enz edited this page Mar 6, 2017 · 8 revisions

Welcome to the nervousnet-HUB-iOS wiki!

Developer Resources:

A bit of API:

AxonStore (Download / Remove Webview Axons) AxonStore is a purely static class. It contains methods to download a list of available axons from the online "store" and allows you to install selected axons.

  • getRemoteAxonList() -> Array<AxonDetails>: Get a list of the available axons in the online store.
  • downloadAndInstall(axonName: String) -> Bool: Install an axon. axonName as provided by the remote list. Returns true if successful.
  • downloadAndInstall(axonIndex: Int) -> Bool: Install an axon. axonIndex as in the remote axon list. Returns true if successful.
  • getInstalledAxonsList() -> Array<AxonDetails>: List of currently installed axons.
  • remove installed axon removeLocalAxon(axonName: String) -> Bool

AxonServerController (Displaying Webview Axons) Create a WebView and call loadUrl with the following URL: http://localhost:8080/axon-res/<axname>/axon.html where axname is the name of the axon as provided by the AxonStore.

Notification Center (Publish/Subscriber - EventBus in android):

  • subscribe:
    NotificationCenter.default.addObserver(self, selector: #selector(onNNEvent(_:)), name: NNEvent.name, object: nil)

Here we subscribe the current object/listener (self) to events with name NNEvent.name (a string) and trigger method onNNEvent() if an event occurs.

  • publish:
NotificationCenter.default.post(name: NNEvent.name, object: nil, userInfo: event.info)

We post an NNEvent.name and provide additional info in userInfo which needs to be a map ([key : value])

  • unpacking event info:
 @objc private func onNNEvent(_ notification : NSNotification)

The signature of a function triggered on event needs to look like this. Access userInfo by calling notification.userInfo

Clone this wiki locally