AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Cross Platform Adaptivity

skill-markdavidgan-apple-dev-skills-cross-platform-adaptivity · by markdavidgan

Adapt one SwiftUI codebase across iPhone, iPad, Mac, Apple Watch, Apple TV, and Vision Pro — size classes, adaptive navigation, multi-window/scenes, platform conditionals, and idiomatic per-platform behavior. Use when supporting iPad alongside iPhone, bringing an app to macOS or visionOS, fixing a layout that only works on one device, choosing adaptive navigation, or sharing code across platforms…

No reviews yet
0 installs
33 views
0.0% view→install

Install

$ agentstack add skill-markdavidgan-apple-dev-skills-cross-platform-adaptivity

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-markdavidgan-apple-dev-skills-cross-platform-adaptivity)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Cross Platform Adaptivity? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Cross-Platform Adaptivity

One codebase, native everywhere — adapt to the device, don't just stretch to fit. A blown-up iPhone UI on iPad or Vision Pro reads as lazy. Share logic; specialize presentation. Pair with apple-design (HIG) and swiftui-micro-craft (polish).

> Principle: design for capabilities and size, not device names. Branch on size class / horizontal space, reserve #if os() for genuinely platform-specific APIs.


Adapt to size, not device

@Environment(\.horizontalSizeClass) private var hSize

var body: some View {
    if hSize == .compact {
        TabView { … }            // iPhone portrait, narrow windows
    } else {
        NavigationSplitView { … } // iPad, Mac, wide windows
    }
}
  • Compact vs regular size classes matter more than iPhone-vs-iPad: an iPad multitasking slide-over is compact, and a Mac window can be resized to either. Respond to the class.
  • Let layout flex with ViewThatFits (pick the first child that fits), adaptive Grid / LazyVGrid(columns: [.adaptive(minimum:)]), and .frame(maxWidth:) reading caps — not hard-coded widths.
  • Avoid magic-number breakpoints; prefer the system's size classes and Dynamic Type.

Adaptive navigation

| Pattern | Compact | Regular | |---------|---------|---------| | NavigationStack | Push/pop column | Push/pop column | | NavigationSplitView | Collapses to a stack automatically | 2–3 column sidebar + content + detail | | TabView | Bottom tabs | Sidebar-adaptable tabs (.tabViewStyle) / top on tvOS |

NavigationSplitView is the workhorse for content apps: it gives a sidebar on iPad/Mac and automatically collapses to a navigation stack on iPhone. Drive selection with state so the same model works in both layouts.


Per-platform idioms (what "native" means on each)

  • iPadOS — pointer/trackpad hover (.hoverEffect), keyboard shortcuts (.keyboardShortcut), multiple windows/scenes, drag & drop, Stage Manager resizing, sidebar. Support external keyboard and the menu bar.
  • macOS — menu bar CommandMenu, Settings scene (⌘,), window management, .focusable, hover, right-click context menus, sensible min window sizes. Mac Catalyst vs native SwiftUI is a porting decision — native SwiftUI for new apps.
  • visionOS — depth, glass materials, ornaments, .windowStyle(.volumetric), immersive spaces, eye/hand input (hover is gaze — generous hit targets). Don't assume a 2D plane; respect the spatial HIG.
  • watchOS — glanceable, short sessions, the Digital Crown, complications; build for the wrist, not a shrunken phone screen.
  • tvOS — the focus engine drives everything; design for a 10-foot distance and the Siri Remote. Focusable, not tappable.

Platform conditionals — use sparingly

#if os(iOS)
    .navigationBarTitleDisplayMode(.inline)   // doesn't exist on macOS
#endif

#if os(visionOS)
    .glassBackgroundEffect()
#endif
  • #if os(iOS|macOS|watchOS|tvOS|visionOS) for compile-time API differences; #if targetEnvironment(macCatalyst) for Catalyst.
  • Prefer runtime size-class/environment checks for layout (one binary adapts live as a window resizes); reserve #if for APIs that don't exist on a platform.
  • Isolate platform code behind small wrappers / extensions so the shared view stays readable. Don't litter body with conditionals.

Structure for sharing

  • One multiplatform target (or shared SwiftUI package) for models, view models, and most views; thin platform layers for the differences. Most SwiftUI views are already portable.
  • Use @Environment-driven styling so components restyle themselves per platform instead of forking.
  • Gate capabilities, not platforms: check for the feature (camera, UIApplication, push) rather than assuming from os().
  • Keep assets/icons per platform in the asset catalog; verify each platform's icon set (see app-brand-identity).

Pre-ship checklist

  • [ ] Works in both size classes (resize the iPad/Mac window; try slide-over).
  • [ ] Navigation collapses sensibly compact↔regular (NavigationSplitView).
  • [ ] No hard-coded widths that break on Mac resize or iPad multitasking.
  • [ ] Each shipped platform uses its idioms (menus on Mac, focus on tvOS, depth on visionOS, Crown on watch).
  • [ ] #if os() limited to true API gaps, not layout.
  • [ ] Keyboard shortcuts & pointer hover on iPad/Mac; VoiceOver/focus verified per platform (see ios-accessibility).
  • [ ] Each platform's app icon and launch experience set correctly.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.