Status: this is a beta version of the SDKs. That means that it contains a subset of the final SDK functionality, and the APIs are subject to change. The latest release of the SDKs is available in the Releases section of this repository.
Ably Asset Tracking is:
This repo holds an Xcode workspace (
ably-asset-tracking-swift), containing 2 libraries/ SDKs:
AblyAssetTrackingPublisherlibrary allows you to use
AblyAssetTrackingSubscriberlibrary allows you to use
Visit the Ably Asset Tracking documentation for a complete API reference and code examples.
These SDKs support support iOS and iPadOS. Support for macOS/ tvOS may be developed in the future, depending on interest/ demand.
To install this package in an Xcode Project:
https://github.com/ably/ably-asset-tracking-swiftin the "Swift Packages" search box. (Xcode project > Swift Packages.. >
To install this package into a Swift Package, add the following to your manifest (
.package(url: "https://github.com/ably/ably-asset-tracking-swift", from: LATEST_VERSION),
The Asset Publisher SDK can be used to efficiently acquire the location data on a device, and publish location updates to other subscribers in real time. Here is an example of how the Asset Publisher SDK can be used:
import AblyAssetTrackingPublisher // Initialise a Publisher publisher = try? PublisherFactory.publishers() // get a Publisher Builder .connection(ConnectionConfiguration(apiKey: ABLY_API_KEY, clientId: CLIENT_ID)) // provide Ably configuration with credentials .log(LogConfiguration()) // provide logging configuration .transportationMode(TransportationMode()) // provide mode of transportation for better location enhancements .delegate(self) // provide delegate to handle location updates locally if needed .start() // Start tracking an asset publisher?.track(trackable: Trackable(id: trackingId)) // provide a tracking ID of the asset
The Asset Subscriber SDK can be used to receive location updates from a publisher in realtime. Here is an example of how Asset Subscribing SDK can be used:
import AblyAssetTrackingSubscriber // Initialise a Subscriber subscriber = try? SubscriberFactory.subscribers() // get a Subscriber Builder .connection(ConnectionConfiguration(apiKey: ABLY_API_KEY, clientId: CLIENT_ID)) // provide Ably configuration with credentials .trackingId(trackingId) // provide a Tracking ID for the asset to be tracked .routingProfile(.cycling) // provide a routing profile for better location enhancements .log(LogConfiguration()) // provide logging configuration .delegate(self) // provide a delegate to handle received location updates .start() // start listening to updates
Configure your mapbox credentials (
~/.netrc) to download the Mapbox SDK by following this guide. You'll need a Mapbox account.
Examples/Secrets.xcconfig file containing credentials (keys/ tokens) is required to build the example apps. (You can use the example
Examples/Example.Secrets.xcconfig, e.g. by running
cp Examples/Example.Secrets.xcconfig Examples/Secrets.xcconfig). Update the following values in
ABLY_API_KEY: Used by all example apps to authenticate with Ably using basic authentication. Not recommended in production, and can be taken from here.
MAPBOX_ACCESS_TOKEN: Used to access Mapbox Navigation SDK/ APIs, and can be taken from here. This is only required to run the Publisher example apps.
AblyAssetTracking.xcworkspace to open a Xcode workspace containing example apps and the Swift Package containing the SDKs that showcase how Ably Asset Tracking SDKs can be used.
Set up a
~/.netrc file by following the Example Apps section. You'll also need the
Examples/Secrets.xcconfig to run the example applications.
These SDKs (libraries/ product in Swift Package terminology) expose targets, which can be imported into a users source code file. We have 4 targets,
AblyAssetTrackingSubscriber. Internal is the only target not exposed (not
importable) to users, and is ideal for interfacing with Ably-cocoa in order to hide ably-cocoa interfaces from end users. All public entities in other targets, such as
AblyAssetTrackingCore, are importable by users, by using
import AblyAssetTrackingCore. All public entities in
AblyAssetTrackingInternal are public to other targets in the same package, but not to users.
AblyAssetTrackingCore is exposed to users through both
AblyAssetTrackingSubscriber by using
Note: The user currently has to import both targets in their code to use entities in both Core and Publisher (or Subscriber). In the future, we may expose both
AblyAssetTrackingPublisher through one target using
@_exported, so users only need to import one module. Similarly, a new target that joins
AblyAssetTrackingSubscriber can be created in the future.
gem install fastlane
ably-asset-tracking-swift-Packageto run all test targets specified in
Package.swiftand press ⌘U or click
Product> `Test. You can also the other autogenerated schemes to run individual test targets.
fastlane test_target_name, where test_target_name can be
test_internalor other test lanes are defined in
To increment the version information for each release from the
Info.plistfiles and increment according to release requirements, conforming to the Semantic Versioning Specification version 2.0.0.
Info.plistfiles and increment the integer value by 1, ignoring those indirected via
$(CURRENT_PROJECT_VERSION)(see next step).
project.pbxprojfilesand increment the integer value by 1.
The version, both in SemVer string form and as an integer, MUST be the same across all projects in this repository (e.g. example app project versions must match those of the library they're built on top of).
|Last commit: 3 weeks ago|
Merged pull requests: