-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the nervousnet-HUB-iOS wiki!
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. Returnstrue
if successful. - install an axon
downloadAndInstall(axonIndex: Int) -> Bool
axonIndex as in the remote axon list. Returnstrue
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.
- 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