---
name: apple-platforms
description: Build apps for macOS, iPadOS, watchOS, and visionOS with platform-specific features. Use when creating menu bar apps, iPad split views, Apple Watch complications, Vision Pro immersive experiences, or multi-platform adaptations.
user-invocable: false
---

# Apple Platform Development

## macOS Specifics

```swift
@main
struct MacApp: App {
    var body: some Scene {
        // Main window
        WindowGroup {
            ContentView()
        }
        .windowStyle(.hiddenTitleBar)
        .windowToolbarStyle(.unified(showsTitle: true))
        .defaultSize(width: 900, height: 600)
        .commands {
            CommandGroup(replacing: .newItem) {
                Button("New Document") { }
                    .keyboardShortcut("n", modifiers: .command)
            }
            ToolbarCommands()
        }

        // Menu bar app
        MenuBarExtra("Status", systemImage: "star.fill") {
            Button("Preferences...") { openSettings() }
            Divider()
            Button("Quit") { NSApp.terminate(nil) }
        }
        .menuBarExtraStyle(.window)

        // Settings window
        Settings {
            SettingsView()
        }
    }
}
```

## iPadOS Adaptive Layouts

```swift
struct AdaptiveView: View {
    @Environment(\.horizontalSizeClass) var sizeClass

    var body: some View {
        if sizeClass == .compact {
            // iPhone or iPad slide-over
            TabView {
                HomeTab()
                SearchTab()
            }
        } else {
            // iPad full screen
            NavigationSplitView {
                Sidebar()
            } detail: {
                DetailView()
            }
        }
    }
}

// Keyboard shortcuts for iPad
struct ContentView: View {
    var body: some View {
        List { }
            .keyboardShortcut("f", modifiers: .command)
            .focusable()
    }
}
```

## watchOS

```swift
@main
struct WatchApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

// Workout tracking
class WorkoutManager: NSObject, ObservableObject {
    private var session: HKWorkoutSession?
    private var builder: HKLiveWorkoutBuilder?
    @Published var heartRate: Double = 0

    func startWorkout(type: HKWorkoutActivityType) async throws {
        let config = HKWorkoutConfiguration()
        config.activityType = type
        config.locationType = .outdoor

        session = try HKWorkoutSession(
            healthStore: HKHealthStore(),
            configuration: config
        )
        builder = session?.associatedWorkoutBuilder()
        session?.startActivity(with: .now)
        try await builder?.beginCollection(at: .now)
    }
}
```

## visionOS Spatial Computing

```swift
@main
struct VisionApp: App {
    var body: some Scene {
        // 2D window
        WindowGroup {
            ContentView()
        }

        // 3D volume
        WindowGroup(id: "globe") {
            Globe3DView()
        }
        .windowStyle(.volumetric)
        .defaultSize(width: 0.5, height: 0.5, depth: 0.5, in: .meters)

        // Immersive space
        ImmersiveSpace(id: "solar-system") {
            SolarSystemView()
        }
        .immersionStyle(selection: .constant(.mixed), in: .mixed)
    }
}

// RealityKit integration
struct ImmersiveView: View {
    var body: some View {
        RealityView { content in
            let sphere = ModelEntity(mesh: .generateSphere(radius: 0.1))
            sphere.position = [0, 1.5, -1]
            content.add(sphere)
        }
        .gesture(TapGesture().targetedToAnyEntity())
    }
}
```

## Multi-Platform Code

```swift
#if os(iOS)
typealias PlatformColor = UIColor
#elseif os(macOS)
typealias PlatformColor = NSColor
#endif

// Conditional compilation
struct ContentView: View {
    var body: some View {
        #if os(watchOS)
        CompactView()
        #elseif os(tvOS)
        LargeDisplayView()
        #else
        StandardView()
        #endif
    }
}
```


---
Source attribution: fusengine
Original project: https://github.com/fusengine/agents/blob/24b70c205d462172a93aa5628f0b99a174282c75/plugins/swift-apple-expert/skills/apple-platforms/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2025 Fusengine

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: fusengine
Original project: https://github.com/fusengine/agents/blob/24b70c205d462172a93aa5628f0b99a174282c75/plugins/swift-apple-expert/skills/apple-platforms/SKILL.md
Attribution basis: Recovered original package and original project license at a pinned revision

Fields of work: Development & Engineering, Product Management
Roles: Frontend Developer, Mobile Developer, Product Manager
Specialties: Frontend, Mobile
Tools: Swift
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 274f905633874165d7a1d888997c658f233e2b21e267aac6863781778e3c1bf8
Metadata reviewed: 2026-10-27
This metadata supersedes earlier Dave AI catalog attribution. Original instruction and supporting files are preserved.
