cross-platform

Structure SwiftUI projects for shared macOS and iOS codebases.

1|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/makgunay/claude-swift-skills --skill cross-platform-makgunay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cross-platform
Source: https://github.com/makgunay/claude-swift-skills/tree/main/cross-platform
Command: npx skills add https://github.com/makgunay/claude-swift-skills --skill cross-platform-makgunay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide and patterns for efficiently developing applications that target both macOS and iOS, ensuring code reuse and platform-specific adaptations.

Core Features & Use Cases

  • Shared Codebase: Structure projects for maximum code sharing (e.g., 70% shared, 15% macOS, 15% iOS).
  • Platform Abstraction: Use protocols and conditional compilation (#if os()) to handle platform differences gracefully.
  • Adaptive UI: Implement layouts that adjust to different screen sizes and platforms (e.g., NavigationSplitView vs. NavigationStack).
  • iOS Extensions: Develop custom keyboards, widgets (home screen, lock screen, Control Center), and share extensions.
  • Data Sync: Configure App Groups, CloudKit sync, and schema versioning for seamless data sharing.
  • Use Case: When starting a new project that needs to run on both iPhone and Mac, use this Skill to set up the project structure, define shared services, and implement platform-specific UI adjustments.

Quick Start

Use the cross-platform skill to set up a new SwiftUI project that shares code between macOS and iOS.

Frequently Asked Questions about cross-platform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share a SwiftUI codebase between iOS and macOS?

To share a SwiftUI codebase between iOS and macOS, structure projects for maximum code reuse (e.g., 70% shared, 15% per platform) using protocols and conditional compilation (`#if os()`). This approach handles platform differences gracefully while maintaining a shared core.

What is the best way to implement adaptive navigation in SwiftUI for cross-platform apps?

Implement adaptive navigation in SwiftUI for cross-platform apps by using `NavigationSplitView` for macOS and `NavigationStack` for iOS. This ensures layouts adjust correctly to different screen sizes and platform expectations.

How do I configure iCloud sync with CloudKit for shared App Groups?

Configure iCloud sync with CloudKit by setting up App Groups to enable shared containers. This allows seamless data sharing between an iOS app and its extensions, supported by schema versioning and migration strategies.

Can I build custom keyboards and widgets for iOS using a shared macOS codebase?

Yes, you can build iOS-specific extensions like custom keyboards, widgets (home screen, lock screen, Control Center), and share extensions while maintaining a shared macOS codebase through platform abstraction techniques.

How do I handle common migration pitfalls when porting a macOS app to iOS?

Handle macOS to iOS migration pitfalls by using platform abstraction via protocols and conditional compilation. This strategy isolates platform-specific code, preventing common UI and data sharing errors during the porting process.

Does SwiftUI require separate project targets for iOS and macOS extensions?

SwiftUI uses a structured project approach with shared targets rather than completely separate ones. You structure projects to isolate iOS extensions (like widgets and keyboards) while sharing the core SwiftUI codebase across both platforms.