Getting started in iOS


Firstly, make sure you have RubyGems installed, then install the xcodeproj gem:

gem install --user xcodeproj

Add the following to your Cartfile:

github "Dronecode/DronecodeSDK-Swift" ~> 0.3.0

And then get the framework using:

carthage bootstrap --platform ios

The steps below assume that your iOS device has a network connection to the drone, e.g. using WiFi.

By default, the SDK will connect using MAVLink on UDP port 14540, which is running by default when PX4 is run in SITL (software in the loop simulation). For now, the backend is limited to UDP even though the core supports UDP, TCP, and serial.

import Dronecode_SDK_Swift

let drone = Drone()

After that, you can start writing some code as described below.

For advanced users: note that startMavlink will run the SDK backend in a background thread on the iOS device. You could connect the SDK to another backend (say, running on a computer with IP by omitting the second line above and running only: let drone = Drone(address: "", port: 50051).

Start writing code

After that, you can start using the SDK, for instance:



     .do(onNext: { next in print(next) })

Learn more about RxSwift here, and have a look at our examples.


Check out the examples for more examples using this framework.


If you want to contribute, please check out: CONTRIBUTING.md.

Build the SDK

Most of the SDK is auto-generated from the proto files (see in proto/protos). Note that they come from a submodule (i.e. you may need to $ git submodule update --init --recursive).

To generate the source code, run:

bash tools/generate_from_protos.bash

After that, you can either build the code with SwiftPM using:

swift build

Or generate an iOS Xcode project with:


This will create the Dronecode-SDK-Swift.xcodeproj project file from project.yml. If you don’t have it already, install Xcodegen with:

brew install xcodegen