Skip to content

Vision OS Target#1691

Merged
garthvh merged 6 commits into
2.7.11from
copilot/create-vision-os-target
Apr 25, 2026
Merged

Vision OS Target#1691
garthvh merged 6 commits into
2.7.11from
copilot/create-vision-os-target

Conversation

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

First step toward a visionOS target (Option A in the plan: add visionOS as a Supported Destination on the existing Meshtastic target rather than a second app target). This PR handles the source-side prep; the Xcode project wiring is a follow-up that must be done in Xcode's target editor.

What changed?

Wrapped all iOS-only subsystems so the Meshtastic target can compile against the visionOS SDK once the destination is added:

  • CarPlay (Meshtastic/CarPlay/*) — #if os(iOS) && canImport(CarPlay)
  • SiriKit Intents (Meshtastic/Intents/*, 5 files using legacy INExtension / INSendMessageIntent etc.) — #if os(iOS)
  • UIApplicationDelegate (MeshtasticAppDelegate.swift, plus the @UIApplicationDelegateAdaptor declaration and appDelegate.router wire-up in MeshtasticApp.swift) — #if os(iOS)
  • Live Activities (Widgets/WidgetsLiveActivity.swift, Widgets/MeshActivityAttributes.swift) — #if os(iOS) (ActivityKit is iOS-only)
  • Call sites — two CarPlayIntentDonation.donate… calls in MeshPackets.swift and AccessoryManager+ToRadio.swift guarded so they compile out on non-iOS
  • TestsMeshtasticTests/CarPlayTests.swift gated with #if os(iOS)

Why did it change?

visionOS lacks CarPlay, SiriKit legacy intents, ActivityKit, and UIApplicationDelegate. Without these guards the existing target won't compile for the xrOS SDK. Using #if os(iOS) (which excludes visionOS) keeps a single multi-platform target per Apple's current Xcode 16 guidance — Option B (separate MeshtasticVision target) would duplicate Core Data, AccessoryManager, and routing code.

Follow-up PRs (must be done in Xcode, not safely doable by editing project.pbxproj headlessly):

  • PR 2: add Apple Vision to Supported Destinations on Meshtastic + MeshtasticTests, set XROS_DEPLOYMENT_TARGET = 2.0, add a visionOS App Icon set, strip unsupported UIBackgroundModes (bluetooth-central/-peripheral/voip) for the visionOS destination, update README platform matrix.
  • PR 3: visionOS UI polish (ornaments, .glassBackgroundEffect()).

WidgetsExtension intentionally stays iOS-only (no Live Activities on visionOS).

How is this tested?

Compile-time only changes; verified by confirming all #if/#endif pairs balance and that every reference to a guarded type (CarPlayIntentDonation, IntentHandler, INSendMessageIntent, etc.) is itself inside a guarded region. Existing iOS / Mac Catalyst builds are unaffected because #if os(iOS) is true for both. Full validation of the visionOS build path happens in PR 2 once the destination is added in Xcode.

Screenshots/Videos (when applicable)

N/A — no UI changes.

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have conducted a self-review of my code.
  • I have commented my code, particularly in complex areas.
  • I have verified whether these changes require an update to existing documentation or if new documentation is needed, and created an issue in the docs repo if applicable.
  • I have tested the change to ensure that it works as intended.

@CLAassistant

CLAassistant commented Apr 24, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ jake-b
✅ garthvh
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@garthvh garthvh changed the title Guard iOS-only subsystems with #if os(iOS) for visionOS compatibility Vision OS Target Apr 25, 2026
@garthvh garthvh marked this pull request as ready for review April 25, 2026 06:38
@garthvh garthvh merged commit 77132af into 2.7.11 Apr 25, 2026
1 of 5 checks passed
@garthvh garthvh deleted the copilot/create-vision-os-target branch April 25, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants