TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | May 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Lars Blumberg.
The Nuimo controller is an intuitive controller for your computer and connected smart devices. This document demonstrates how to integrate your iOS and MacOS applications with Nuimo controllers using the Nuimo SDK. The Nuimo SDK supports both applications written in Swift and in Objective-C.
The Nuimo Swift SDK is available through CocoaPods, a very good dependency manager for Swift and Objective-C applications. (If you don’t want to use CocoaPods just copy all .swift
files from folder SDK
into your Xcode project and skip to the next step.)
Edit your project’s Podfile
to add the following line:
pod 'NuimoSwift', '~> 0.5.0'
Then from a terminal within your project’s root folder run:
pod install
This should install the Nuimo Swift SDK and add it to your workspace. Now open your project’s workspace and start playing around with the Nuimo Swift SDK. Don’t forget to import the module NuimoSwift
where necessary.
The Nuimo SDK makes it very easy to connect your iOS and MacOS applications with Nuimo controllers. It only takes three steps and a very few lines of code to discover your Nuimo and receive gesture events:
Assign a delegate to an instance of NuimoDiscoveryManager
and call startDiscovery()
. This will discover Nuimo controllers nearby.
Receive discovered controllers by implementing the delegate method nuimoDiscoveryManager:didDiscoverNuimoController:
. Here you can
connect()
Implement the delegate method nuimoController:didReceiveGestureEvent:
to access user events performed with the Nuimo controller
The following code example demonstrates how to discover, connect and receive gesture events from your Nuimo. As you might know, use either UIViewController
on iOS or NSViewController
on MacOS systems.
import NuimoSwift
class ViewController : UIViewController|NSViewController, NuimoDiscoveryDelegate, NuimoControllerDelegate {
let discovery = NuimoDiscoveryManager.sharedManager
override func viewDidLoad() {
super.viewDidLoad()
discovery.delegate = self
discovery.startDiscovery()
}
func nuimoDiscoveryManager(discovery: NuimoDiscoveryManager, didDiscoverNuimoController controller: NuimoController) {
controller.delegate = self
controller.connect()
}
func nuimoController(controller: NuimoController, didReceiveGestureEvent event: NuimoGestureEvent) {
print("Received event: \(event.gesture.identifier), value: \(event.value)")
}
}
We’ve provided a ready to checkout application that demonstrates discovering, connecting and receiving events from your Nuimo controllers. Simply clone the Nuimo MacOS demo repository, open the included Xcode workspace and hit the Run button to execute the application. Before that, make sure that the correct target NuimoDemoOSX
is selected.
The NuimoSwift SDK is much more powerful than the use cases presented above. More details to follow here soon.
Have questions or suggestions? Drop us a mail at [email protected]. We’ll be happy to hear from you.
The NuimoSwift source code is available under the MIT License.