iOS Client IAM Util
The iOS IAM Util is a helper component that simplifies pairing scenarios and other interaction with the IAM CoAP interface on Nabto Edge Embedded SDK devices.
It is installed with Swift Package Manager from the edge-iamutil-swift github repository. All dependencies, including the iOS Client SDK, are resolved automatically.
INSTALLATION
In your .xcodeproj or .xcworkspace, add the package by pressing File > Add Package Dependencies... and entering the package URL https://github.com/nabto/edge-iamutil-swift. Then go to the settings for your target in your Xcode project and add NabtoEdgeIamUtil to the “Frameworks, Libraries, and Embedded Content” option.
If you are using a Package.swift file to specify dependencies, first add the following line to the dependencies list.
.package(url: "https://github.com/nabto/edge-iamutil-swift.git", from: "2.0.0")
Then add NabtoEdgeIamUtil to your target’s dependencies:
.target(name: "example", dependencies: ["NabtoEdgeIamUtil"]),
USE THE SDK
To use the iOS IAM UTIL, add the following to your source file:
import NabtoEdgeIamUtil
Now you can invoke the IAM Util:
NabtoEdgeIamUtil.IamUtil.getDeviceDetailsAsync(connection: connection) { ec, result in
if (ec == .OK) {
if let details = result {
self.appendText("Nabto Embedded SDK version: \(details.NabtoVersion)")
self.appendText("Device app version: \(details.AppVersion ?? "(n/a)")")
self.appendText("Device app name: \(details.AppName ?? "(n/a)")")
self.appendText("Pairing modes available: \(details.Modes)")
} else {
self.appendText("getDeviceDetails returned OK with empty response (never here)")
}
} else {
self.appendText("getDeviceDetails failed with status \(ec)")
}
}
