Connect and Command

Although I ‘m writing a series of tutorials on how to program DJI drones, when I’m asked which is the ideal beginner drone for learning to fly and for programming, my standard answer is the Ryze Tello. Here are a few reasons to choose it:
- Fairly low price
- Easy to program in different languages
- Safe to fly indoors
- Very durable
Let’s be honest: there are some disadvantages as well:
- No GPS
- Not suitable in windy conditions
- Prone to Wi‑Fi interference
- Limited range
- No gimbal; fixed camera only
If you already have a Ryze Tello, an iPhone, and a MacBook, this tutorial is the right place to start coding.
This tutorial provides a complete iOS app implemented in Swift and SwiftUI that connects to the Tello drone and issues commands such as takeoff and land.
If you cannot accept the Tello’s drawbacks or need a drone for outdoor use with extended range, I recommend my series “Programming DJI Drones”.
The example app exposes a few buttons; each button invokes a drone command. I implemented the following commands:
- Connect to the drone
- Enable command mode
- Takeoff
- Land
- Rotate 360° clockwise
- Rotate 360° counter-clockwise
Here is a screenshot of the app after you build and run it on your phone.

All commands are documented in the Tello SDK manual. See the Resources section at the end of this post for links.
This code gives you everything needed to extend the app and add your own functionality.
There are at least two more tutorials planned for the Tello drone.
The second tutorial covers receiving telemetry data and displaying it in real time in the app.
In the third part we tap into the Tello’s video stream and show it full-screen on the iOS device.
The complete code for this tutorial can be downloaded from here.
Establishing a Connection
All communication with the Tello drone is based on UDP and is handled by the UdpSender class in the accompanying tutorial app.
To send commands like takeoff and land, we first need to connect.
We use Apple’s Network framework, which makes it straightforward to establish a UDP connection and send data.
The following code is part of UdpSender and, when called, initiates a connection to a host at a specified port.
func connect() {
connection = NWConnection(host: host, port: port, using:.udp)
connection!.stateUpdateHandler = { (newState) in
...
}
connection!.viabilityUpdateHandler = { (isViable) in
...
}
connection!.betterPathUpdateHandler = { (betterPathAvailable) in
...
}
connection!.start(queue:.global())
}
Only after this step can we issue commands to make the drone do what it is supposed to do: take off and fly.
Command Mode
The Tello must be set to command mode before we can issue other commands like takeoff and land.
You can check if your drone is already in command mode when the front light is blinking slowly green. If it blinks red after a while, the drone has not received a command within 15 seconds.
The Tello SDK documentation contains the complete list of available commands that can be sent to the drone.
UdpSender contains the code to send commands:
func send(_ payload: Data) {
guard let connection = self.connection else { return }
connection.send(content: payload, completion:.contentProcessed({ sendError in
...
}))
}
There’s not much more to it— it really is that simple.
When the Tello receives a command and finishes executing it, it replies with “ok”.
I have noticed that sometimes this “ok” can appear scrambled, and the console may display weird characters. That does not prevent sending another command.
Go ahead and build the app on your iPhone. We ‘ll need it for the next step.
Takeoff and Fly
With the app built and ready to run on your iPhone, it ‘s time to get the drone airborne.
Follow these steps:
- Insert the battery into the drone
- Switch on the drone; after a short time it should blink yellow
- Connect your phone’s Wi‑Fi to the drone’s network

- Start the app
- Press the “Connect” button
- The drone should blink green now
- Press the “Takeoff” button
Well done— happy flying!
Conclusion
Now you have everything you need to control your Tello drone with your own SwiftUI app.
Extend it with more commands and features.
In the meantime, I ‘m working on the second part of the tutorial for receiving and displaying telemetry data.
The complete code for this tutorial can be downloaded from here.