Vision OS Target#1691
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/c28dfa0a-9d81-4e16-ade1-a480efcbca2b Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
garthvh
April 24, 2026 23:12
View session
|
|
#if os(iOS) for visionOS compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step toward a visionOS target (Option A in the plan: add visionOS as a Supported Destination on the existing
Meshtastictarget 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
Meshtastictarget can compile against the visionOS SDK once the destination is added:Meshtastic/CarPlay/*) —#if os(iOS) && canImport(CarPlay)Meshtastic/Intents/*, 5 files using legacyINExtension/INSendMessageIntentetc.) —#if os(iOS)MeshtasticAppDelegate.swift, plus the@UIApplicationDelegateAdaptordeclaration andappDelegate.routerwire-up inMeshtasticApp.swift) —#if os(iOS)Widgets/WidgetsLiveActivity.swift,Widgets/MeshActivityAttributes.swift) —#if os(iOS)(ActivityKit is iOS-only)CarPlayIntentDonation.donate…calls inMeshPackets.swiftandAccessoryManager+ToRadio.swiftguarded so they compile out on non-iOSMeshtasticTests/CarPlayTests.swiftgated 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 (separateMeshtasticVisiontarget) would duplicate Core Data,AccessoryManager, and routing code.Follow-up PRs (must be done in Xcode, not safely doable by editing
project.pbxprojheadlessly):Meshtastic+MeshtasticTests, setXROS_DEPLOYMENT_TARGET = 2.0, add a visionOS App Icon set, strip unsupportedUIBackgroundModes(bluetooth-central/-peripheral/voip) for the visionOS destination, update README platform matrix..glassBackgroundEffect()).WidgetsExtensionintentionally stays iOS-only (no Live Activities on visionOS).How is this tested?
Compile-time only changes; verified by confirming all
#if/#endifpairs 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