iOS Client SDK (Swift)
The recommended way to integrate the Nabto Edge Client SDK in your iOS application is to use the high level Swift based iOS Client SDK. The simplest way to install this is through the NabtoEdgeClientSwift
Cocoapod. For an intro to the Cocoapods dependency manager, visit cocoapods.org.
COCOAPOD BASED INSTALLATION
Podfile
Reference the SDK from a Podfile
in the root directory of your project:
platform :ios, '12.0'
target 'NabtoEdgeSwiftDemo' do
pod 'NabtoEdgeClientSwift'
end
Install
Run pod install
:
$ pod install
Analyzing dependencies
Downloading dependencies
Installing NabtoEdgeClientSwift (3.0.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
If this is the first pod you use in your Xcode project, you must close your project file and open the generated workspace instead.
INSTALL WITHOUT COCOAPODS
You can also build the iOS Client SDK from source, available in github. It is just a thin wrapper around the Plain C Client SDK for iOS.
USE THE SDK
To use the Nabto Edge iOS Client SDK, add the following to your source file:
import NabtoEdgeClient
Now you can invoke the SDK:
print(NabtoEdgeClient.Client.versionString())
The Client
class is the main entry point for the SDK, from here you can create Connection
objects that in turned can be used with the available communication patterns (Nabto Edge CoAP, Streams and Tunnels).
See the API docs for more details and the examples below.
EXAMPLES
A simple smoke test that just demonstrates all the basic plumbing is in place can be found in the iOS Client SDK github repo, NabtoEdgeClientHello.
A more thorough demo example will soon be available. In the meantime, see the iOS Client SDK integration tests for examples of using the SDK.