Build a Flight Tracker with the MyRadar iOS SDK
Follow live flights over animated radar in a one-screen SwiftUI app built with the iOS SDK.
Oct 9, 2026 · Shell · Swift
The SDK's demo app is a one-screen flight tracker: enter a flight number, watch
the flight over live radar, and switch weather layers on and off. This walkthrough
covers the few calls that matter; the complete source is in
ios-demo in the
MyRadar SDK samples repository on GitHub.

Quickstart (command line)#
On a Mac with Xcode 16 or later, these commands clone the sample, build it and
launch it on a simulator with your key. Replace your-myradar-api-key, and set
SIM to any iOS 17 or later simulator from xcrun simctl list devices available.
export MYRADAR_API_KEY=your-myradar-api-key
git clone https://github.com/MyRadar/MyRadar-SDK-Samples.git
cd MyRadar-SDK-Samples/ios-demo
SIM="iPhone 16"
UDID=$(xcrun simctl list devices available | grep -m1 " $SIM (" | grep -oE '[0-9A-F-]{36}')
xcrun simctl boot "$UDID" 2>/dev/null || true
xcodebuild -project MyRadarSDKDemo.xcodeproj -scheme MyRadarSDKDemo \
-destination "id=$UDID" -derivedDataPath build \
-packageAuthorizationProvider netrc -quiet build
xcrun simctl install "$UDID" build/Build/Products/Debug-iphonesimulator/MyRadarSDKDemo.app
SIMCTL_CHILD_MYRADAR_API_KEY="$MYRADAR_API_KEY" \
xcrun simctl launch "$UDID" com.myradar.MyRadarSDKDemo
open -a Simulator --args -CurrentDeviceUDID "$UDID" 2>/dev/null ||
open -b com.apple.dt.Devices --args -CurrentDeviceUDID "$UDID"SIM can be any iOS 17 or later simulator; xcrun simctl list devices available lists them.
Booting a simulator that is already running is fine. The last command brings up the
simulator's window: in the Simulator app, or in Device Hub in newer versions of Xcode,
which replaces it. The app runs either way; without that window you just can't see it.
The first build downloads the MyRadarSDK package, so it takes a few minutes.
-packageAuthorizationProvider netrc stops xcodebuild from waiting on a
Keychain prompt for GitHub credentials, which the public package doesn't need.
The key reaches the app through the xcrun simctl launch command (SIMCTL_CHILD_
passes an environment variable to the launched app), so start the app with that
command again rather than from the simulator's home screen.
Run the demo in Xcode#
Prefer Xcode to the command line? You need Xcode 16 or later, an iOS 17 or later simulator, and a MyRadar API key from the developer portal.
- Clone the repository and open
ios-demo/MyRadarSDKDemo.xcodeproj. Wait until MyRadarSDK appears under Package Dependencies. - Choose Product > Scheme > Edit Scheme…, select Run > Arguments, and add the
environment variable
MYRADAR_API_KEYwith your key. Leave Shared unchecked so the key stays out of git. - Press ⌘R and enter a flight number such as
AA 100orAA 1643.
Radar appears within a few seconds. A map with no weather means the key is missing (Xcode's
console says [MyRadarSDK] No API key) or was rejected.
Step 1: Add the package and your key#
Add the Swift package https://github.com/MyRadar/MyRadar-iOS-SDK-SPM (File > Add Package
Dependencies…), link its MyRadarSDK product, and configure the SDK once at launch:
import MyRadar_iOS_SDK
@main
struct FlightTrackerApp: App {
init() {
MyRadarSDK.configure(apiKey: "<your key>")
}
var body: some Scene { WindowGroup { ContentView() } }
}Load the key from wherever your app keeps secrets, such as a git-ignored .xcconfig read through
Info.plist.
Step 2: Show the map#
The map is one view, configured with modifiers. Keep layer choices in your own state:
@State private var overlays: Set<Overlay> = [.warnings, .lightning]
MyRadarMap()
.camera(center: CLLocationCoordinate2D(latitude: 37.5, longitude: -96), zoom: 5)
.overlays(overlays)Radar is on by default. .mapStyle(_:), .radarProduct(_:) and .radarOpacity(_:) change the
rest; the sample's layer chips and opacity slider show them in use.
Step 3: Show a flight#
One modifier shows a flight. Keep the flight number in state and pass it to .flight(_:); nil
shows none. The SDK looks the flight up, draws it, centers the map on the aircraft with the whole trip in view, and updates it every minute
until it lands:
@State private var ident: String?
@State private var flight: FlightInfo?
MyRadarMap()
.overlays(overlays)
.flight(ident)
.onFlightUpdate { flight = $0 }
.onFlightError { error in message = error.localizedDescription }Set ident from a search field. It accepts a flight number (AA 100, AA 1643) or a callsign
(UAL1). When a number flies several legs a day, the SDK shows the leg in progress, otherwise
the next to depart, otherwise the most recent, which stays on the map for 30 minutes after it
lands.
To keep the camera where it is when a flight loads, pass
FlightOptions(fitToFlight: false). Updates never move the map. In UIKit,
mapView.fitToFlight() brings the whole flight into view whenever you want.
The map shows the planned route, the track flown, the route ahead, both airports and the
aircraft. Over oceans the aircraft is drawn hollow while its position is an estimate.
FlightOptions turns parts off or changes the color, for example
.flight(ident, options: FlightOptions(plannedRoute: false)), and
FlightOptions(aircraftIcon: UIImage(named: "MyAircraft")) draws your own aircraft image,
nose up. In UIKit, call
try await mapView.showFlight("AA10").

Step 4: Fill in the flight card#
Each update is a FlightInfo, so the card needs no calculations of its own:
Text(flight.ident) // "AA 10"
Text("\(flight.origin?.code ?? "") → \(flight.destination?.code ?? "")")
ProgressView(value: flight.progress ?? 0)
Text(flight.estimatedArrival?.formatted(date: .omitted, time: .shortened) ?? "—")
Text(flight.position?.altitudeFeet.map { "\(Int($0)) ft" } ?? "—")Step 5: Show attributions#
Apps that ship the SDK must display its licenses and data attributions, for example on an about screen:
Text(MyRadarMapView.licensesAndAttributions.map(\.name).joined(separator: ", "))Next#
The sample app adds layer chips, an opacity slider, base map and radar product menus, and a landscape layout. Its README lists which SDK API each part uses.