Skip to content

murmurations-dev/multiplatform-26

Repository files navigation

Multiplatform 26

A sample SwiftUI app showcasing an adaptive, multiplatform UI that targets iOS, iPadOS, macOS, watchOS, tvOS, and visionOS. It demonstrates:

  • Navigation patterns across platforms (NavigationStack and NavigationSplitView)
  • Platform-aware styling and layout
  • Toolbar customization per platform
  • Simple master-detail flow with a sidebar on iPad and larger screens
  • Reusable components and preview support

Highlights

  • iOS & iPadOS
    • Uses size classes to switch between single-column (NavigationStack) and split view (NavigationSplitView) when appropriate (e.g., iPad or iPhone landscape).
    • Adaptive list styling and padding based on size classes.
  • macOS
    • Standard windowed experience with NavigationStack and platform-appropriate list styling.
  • watchOS
    • Glanceable, compact UI with simplified toolbar actions and smaller typography.
  • tvOS
    • Focus on large, spacious layouts and focus-based navigation (placeholder messaging in the UI).
  • visionOS
    • Copy and layout tuned for spatial computing (placeholder messaging in the UI).

Screens/Components

  • ContentView
    • Shows a platform label, a platform-specific hint, and two demo sections: Capabilities and Layout demo.
    • On iPad or wide layouts, presents a sidebar with selectable items and a detail pane with metadata and actions.
    • On compact layouts, uses a single-column navigation stack.
  • Detail View (inline in ContentView)
    • Displays an item header, metadata (platform hint, identifier, and platform-specific details), and a small grid of stats/actions.

How it Adapts

  • Size classes (horizontal and vertical) drive whether iOS uses a split view or single-column navigation.
  • List style and padding vary by platform and size class to feel native everywhere.
  • Toolbar content is tailored per platform (e.g., a simple trailing button on watchOS, a primary action button elsewhere).

Requirements

  • Xcode 26.3 or later
  • Swift 6 (as configured by your project settings)
  • Platforms: iOS 18, iPadOS 18, macOS 15, watchOS 11, tvOS 18, visionOS 2 (or the minimums you set in your project)

Running the Project

  1. Open the project in Xcode.
  2. Select a scheme for the platform you want to run (iOS Simulator, watchOS, macOS app, etc.).
  3. Build and run (Cmd+R).

To see the iPad split view behavior on iOS:

  • Run on an iPad simulator or rotate an iPhone simulator to landscape.

Project Structure (excerpt)

  • ContentView-Shared.swift
    • Contains the platform-adaptive ContentView that switches between NavigationStack and NavigationSplitView.
    • Implements platform-specific list styles, padding, and toolbar items.
  • Additional files (Capabilities, LayoutDemo) are referenced by ContentView to showcase sections; adjust or expand as needed.

Customization Tips

  • Update the title, platformLabel, and platformHint computed properties in ContentView to customize platform strings.
  • Modify the listStyle, listPadding, and hintFont properties to tweak platform-specific appearance.
  • Extend the detail section’s grid and actions to match your app’s real-world functionality.

Screenshots

Add screenshots per platform once available:

  • iOS/iPadOS: Screenshots of single-column and split view
  • macOS: Main window with list
  • watchOS: Compact list and toolbar button
  • tvOS: Large list with focus navigation
  • visionOS: Main view in a window

License

This sample is provided as-is, without warranty of any kind. Use it freely within your own projects.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages