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.

  • get list of the available axons in the online store: getRemoteAxonList() -> Array<AxonDetails>
  • install an axon downloadAndInstall(axonName: String) -> Bool axonName as provided by the remote list. Returns true if successful.
  • install an axon downloadAndInstall(axonIndex: Int) -> Bool axonIndex as in the remote axon list. Returns true if successful.
  • list of currently installed axons getInstalledAxonsList() -> Array<AxonDetails>
  • 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