Skip to content
Mobile
Skill

/dat-conventions

Swift patterns, async/await, naming conventions, key types for DAT SDK iOS development

From plugin
meta-wearables-dat-ios
58917 skills

Claude Code

$ npx -y skills add meta/meta-wearables-dat-ios --skill dat-conventions --agent claude-code

SKILL.md

dat-conventions.SKILL.md
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**: `MockDeviceTestClient` for driving MockDeviceKit over HTTP from a UI-test process

Swift Patterns

  • Use `async/await` for registration, permission, and URL-handling calls; `createSession`, `DeviceSession.start()`, `addCamera`, and `Stream.start()` are synchronous
  • 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

import MWDATCore    // Registration, devices, permissions
import MWDATCamera  // Stream, VideoFrame, photo capture
import MWDATDisplay // Display, FlexBox, Text, Button, Image, Icon, VideoPlayer

For testing:

import MWDATMockDevice  // MockDeviceKit, MockGlasses, MockCameraKit

Key Types

  • `Wearables` — SDK entry point. Call `Wearables.configure()` at launch, then use `Wearables.shared` (an `any WearablesInterface`)
  • `DeviceSession` — The connection to a selected device. Create with `createSession(deviceSelector:)`, then attach capabilities
  • `Camera` — Camera capability from `session.addCamera(config:)`; owns `camera.stream`
  • `Stream` — Camera stream: `start()`, `stop()`, `capturePhoto(format:)`, and the frame/state/photo/error publishers
  • `Display` — Display capability from `session.addDisplay()`
  • `VideoFrame` — Individual video frame with `.makeUIImage()` and `.sampleBuffer`
  • `Device` / `DeviceIdentifier` — `DeviceIdentifier` is a `String`; resolve a `Device` with `deviceForIdentifier(_:)`
  • `AutoDeviceSelector` — Selects the best available device, optionally filtered (`filter: { $0.supportsDisplay() }`)
  • `SpecificDeviceSelector` — Selects a specific device by `DeviceIdentifier`
  • `StreamConfiguration` — Configure video codec, resolution, frame rate
  • `ListenerTokenBag` / `AnyListenerToken` — Keep `.listen {}` subscriptions alive; dropping a token cancels it
  • `MockDeviceKit` — Factory for creating simulated devices in tests

Error Handling

do {
    try Wearables.configure()
} catch {
    // Handle configuration error
}

do {
    try await Wearables.shared.startRegistration()
} catch {
    // Handle registration error
}

Build and Test

# Install dependencies via Swift Package Manager
# In Xcode: File > Add Package Dependencies > enter repo URL

# Build from command line
xcodebuild -scheme MWDATCore -destination 'platform=iOS Simulator,name=iPhone 16'

# Run tests
xcodebuild test -scheme MWDATCoreTests -destination 'platform=iOS Simulator,name=iPhone 16'

For sample apps:

# Open the sample app workspace
open 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

1. **Add SDK** via Swift Package Manager (SPM) in Xcode 2. **Import modules** (`MWDATCore`, `MWDATCamera`, `MWDATDisplay` when rendering Display content) 3. **Configure** at app launch: `try Wearables.configure()` 4. **Build** with Xcode or `xcodebuild` 5. **Test** with MockDeviceKit - no physical glasses required 6. **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.

Links

  • [iOS API Reference](https://wearables.developer.meta.com/docs/reference/ios_swift/dat/latest)
  • [Developer Documentation](https://wearables.developer.meta.com/docs/develop/)
  • [GitHub Repository](https://github.com/meta/meta-wearables-dat-ios)
Read more
@facebook
Ships withmeta-wearables-dat-ios

The Meta Wearables Device Access Toolkit enables developers to utilize Meta's AI glasses to build hands-free wearable experiences into their mobile applications.

Stars on GitHub

Momentum

stars in total
589
Star history of facebook/meta-wearables-dat-ios on GitHub, a chart by star-history.com

Other skills on meta-wearables-dat-ios.

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo10d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens4w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about dat-conventions.

Which coding agents can use dat-conventions?
dat-conventions installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.