<< All versions
Skill v1.0.1
currentAutomated scan100/100facebook/meta-wearables-dat-ios/dat-conventions
+2 new
──Details
PublishedOctober 2, 2026 at 06:15 PM
Content Hashsha256:0c7535acd4c74610...
Git SHA122fd163cc57
Bump Typepatch
──Files
Files (1 file, 4.9 KB)
SKILL.md4.9 KBactive
SKILL.md · 125 lines · 4.9 KB
version: "1.0.1" name: dat-conventions description: Swift patterns, async/await, naming conventions, key types for DAT SDK iOS development
DAT SDK Conventions (iOS)
Architecture
The public SDK is organized into these modules:
- MWDATCore: Device discovery, registration, permissions, device selectors,
DeviceSession - MWDATCamera:
Camera,Stream,VideoFrame, photo capture - MWDATDisplay: Display capability, display UI components, icons, images, buttons, video
- MWDATMockDevice: MockDeviceKit for testing without hardware
- MWDATMockDeviceTestClient:
MockDeviceTestClientfor driving MockDeviceKit over HTTP from a UI-test process
Swift Patterns
- Use
async/awaitfor all SDK operations — the SDK is fully async - Use
AsyncSequence/ publisher.listen {}for observing streams - Annotate UI-updating code with
@MainActor - Never block the main thread with frame processing
- Handle errors with do/catch — the SDK throws typed errors
Naming Conventions
| Type | Convention | Example | |
|---|---|---|---|
| Entry point | Wearables.shared | Wearables.shared.startRegistration() | |
| Device sessions | *Session | DeviceSession | |
| Capabilities | Named by function | Stream | |
| Selectors | *DeviceSelector | AutoDeviceSelector, SpecificDeviceSelector | |
| Config | *Configuration | StreamConfiguration | |
| Publishers | *Publisher | statePublisher, videoFramePublisher |
Imports
swift
import MWDATCore // Registration, devices, permissionsimport MWDATCamera // Stream, VideoFrame, photo captureimport MWDATDisplay // Display, FlexBox, Text, Button, Image, Icon, VideoPlayer
For testing:
swift
import MWDATMockDevice // MockDeviceKit, MockGlasses, MockCameraKit
Key Types
Wearables— SDK entry point. CallWearables.configure()at launch, then useWearables.shared(anany WearablesInterface)DeviceSession— The connection to a selected device. Create withcreateSession(deviceSelector:), then attach capabilitiesCamera— Camera capability fromsession.addCamera(config:); ownscamera.streamStream— Camera stream:start(),stop(),capturePhoto(format:), and the frame/state/photo/error publishersDisplay— Display capability fromsession.addDisplay()VideoFrame— Individual video frame with.makeUIImage()and.sampleBufferDevice/DeviceIdentifier—DeviceIdentifieris aString; resolve aDevicewithdeviceForIdentifier(_:)AutoDeviceSelector— Selects the best available device, optionally filtered (filter: { $0.supportsDisplay() })SpecificDeviceSelector— Selects a specific device byDeviceIdentifierStreamConfiguration— Configure video codec, resolution, frame rateListenerTokenBag/AnyListenerToken— Keep.listen {}subscriptions alive; dropping a token cancels itMockDeviceKit— Factory for creating simulated devices in tests
Error Handling
swift
do {try Wearables.configure()} catch {// Handle configuration error}do {try await Wearables.shared.startRegistration()} catch {// Handle registration error}
Build and Test
bash
# Install dependencies via Swift Package Manager# In Xcode: File > Add Package Dependencies > enter repo URL# Build from command linexcodebuild -scheme MWDATCore -destination 'platform=iOS Simulator,name=iPhone 16'# Run testsxcodebuild test -scheme MWDATCoreTests -destination 'platform=iOS Simulator,name=iPhone 16'
For sample apps:
bash
# Open the sample app workspaceopen ExternalSampleApps/CameraAccess/CameraAccess.xcodeproj# Build and run on simulator (uses MockDeviceKit - no glasses needed)xcodebuild -scheme CameraAccess -destination 'platform=iOS Simulator,name=iPhone 16'
Development Workflow
- Add SDK via Swift Package Manager (SPM) in Xcode
- Import modules (
MWDATCore,MWDATCamera,MWDATDisplaywhen rendering Display content) - Configure at app launch:
try Wearables.configure() - Build with Xcode or
xcodebuild - Test with MockDeviceKit - no physical glasses required
- Debug using Xcode console for SDK logs
Live docs search
If your editor supports remote MCP servers, connect https://mcp.developer.meta.com/wearables and use search_dat_docs for current DAT setup, session lifecycle, camera streaming, MockDeviceKit, permissions, and exact API symbols. This public docs server does not require authentication; do not configure tokens, OAuth, or custom authorization headers for it.
See the dat-docs-mcp skill for Claude Code, Cursor, and MCP Inspector setup and troubleshooting.
Use llms.txt when your tool only supports static reference context.