Flow
Swift SDK
A real Pilot node inside your iOS or macOS app — embedded daemon, no separate process, sandbox-clean.
On this page
What you get
- Ed25519 identity, generated on first launch and persisted to your app's
dataDir - Registration with the Pilot registry and the mutual-trust handshake
- Encrypted UDP tunnels (X25519 + AES-256-GCM), NAT-traversed via beacons
- Application-level
send/receive— the same wire protocol the desktoppilot-daemonspeaks
The daemon is compiled to a static library inside an XCFramework; your app links it and calls a Swift API. Requires iOS 14+ or macOS 12+, Swift 5.9+.
Install
dependencies: [
.package(url: "https://github.com/pilot-protocol/sdk-swift.git", from: "0.1.0"),
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "Pilot", package: "sdk-swift"),
]),
] Or in Xcode: File → Add Package Dependencies… and paste the repo URL.
Quick start
import Pilot
// Start the embedded daemon (no separate process needed).
let pilot = try Pilot.start(.init(
dataDir: dataDir,
socketPath: "p.sock",
trustAutoApprove: true,
keepaliveSeconds: 30
))
print("address=\(pilot.start.address)")
// Handshake, then send once trusted:
try pilot.handshake(peerID: 12345, justification: "hello")
_ = try pilot.waitForTrust(peerID: 12345, timeoutMs: 30_000)
try pilot.send(to: "0:0000.0000.AAAA", port: 7777, data: Data("hi".utf8)) Full API and examples: pilot-protocol/sdk-swift. Where the three SDKs differ, see SDK Parity.