---
name: getting-started
description: SDK setup, Swift Package Manager integration, Info.plist configuration, and first connection to Meta glasses
---
# Getting Started with DAT SDK (iOS)
Set up the Meta Wearables Device Access Toolkit in an iOS app.
## Prerequisites
- Xcode 15.0+, iOS 16.0+ deployment target
- Meta AI companion app installed on test device
- Ray-Ban Meta glasses or Meta Ray-Ban Display glasses (or use MockDeviceKit for development)
- Developer Mode enabled in Meta AI app (Settings > Your glasses > Developer Mode)
## Step 1: Add the SDK via Swift Package Manager
1. In Xcode, select **File** > **Add Package Dependencies...**
2. Enter `https://github.com/facebook/meta-wearables-dat-ios`
3. Select a [version](https://github.com/facebook/meta-wearables-dat-ios/tags)
4. Add `MWDATCore` and `MWDATCamera` to your target
## Step 2: Configure Info.plist
Add these required entries to your `Info.plist`:
```xml
CFBundleURLTypes
CFBundleTypeRole
Editor
CFBundleURLName
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleURLSchemes
myexampleapp
UISupportedExternalAccessoryProtocols
com.meta.ar.wearable
UIBackgroundModes
bluetooth-peripheral
external-accessory
NSBluetoothAlwaysUsageDescription
Needed to connect to Meta Wearables
MWDAT
AppLinkURLScheme
myexampleapp://
MetaAppID
0
```
Replace `myexampleapp` with your app's URL scheme. Use `0` for `MetaAppID` during development with Developer Mode, and add `fb-viewapp` to your app's Info.plist query-schemes allowlist.
## Step 3: Initialize the SDK
Call `Wearables.configure()` once at app launch:
```swift
import MWDATCore
@main
struct MyApp: App {
init() {
do {
try Wearables.configure()
} catch {
assertionFailure("Failed to configure Wearables SDK: \(error)")
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
```
## Step 4: Handle URL callbacks
Your app must handle the URL callback from Meta AI after registration:
```swift
.onOpenURL { url in
Task {
_ = try? await Wearables.shared.handleUrl(url)
}
}
```
## Step 5: Register with Meta AI
```swift
func startRegistration() async throws {
try await Wearables.shared.startRegistration()
}
```
Observe registration state:
```swift
Task {
for await state in Wearables.shared.registrationStateStream() {
// Update UI based on registration state
}
}
```
## Step 6: Start streaming
```swift
import MWDATCore
import MWDATCamera
// Create a DeviceSession — device selection is configured here
let wearables = Wearables.shared
let deviceSelector = AutoDeviceSelector(wearables: wearables)
let deviceSession = try wearables.createSession(deviceSelector: deviceSelector)
try deviceSession.start()
// Wait for the device session to reach the started state
for await state in deviceSession.stateStream() {
if state == .started { break }
}
let config = StreamConfiguration(
videoCodec: .raw,
resolution: .low,
frameRate: 24
)
guard let stream = try deviceSession.addStream(config: config) else {
return
}
// Observe frames
let frameToken = stream.videoFramePublisher.listen { frame in
guard let image = frame.makeUIImage() else { return }
Task { @MainActor in
self.currentFrame = image
}
}
// Start the stream capability
Task { await stream.start() }
```
## Next steps
- [Camera Streaming](camera-streaming.md) — Resolution, frame rate, photo capture
- [MockDevice Testing](mockdevice-testing.md) — Test without hardware
- [Session Lifecycle](session-lifecycle.md) — Handle pause/resume/stop
- [Permissions](permissions-registration.md) — Camera permission flows
- [Full documentation](https://wearables.developer.meta.com/docs/develop/)