Fix visionOS availability error for split(by:) method#45
Merged
Recouse merged 1 commit intoRecouse:mainfrom Feb 19, 2026
Merged
Fix visionOS availability error for split(by:) method#45Recouse merged 1 commit intoRecouse:mainfrom
Recouse merged 1 commit intoRecouse:mainfrom
Conversation
Use compile-time #if os(visionOS) conditional to exclude the legacy split(by:) fallback on visionOS, since visionOS 1.0+ always has the modern split(separator:) API available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
|
That's a good catch, thank you! |
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.
Summary
split(by:)was unavailable on visionOSEnvironment
Problem
The existing code used a runtime
#availablecheck to choose betweensplit(separator:)(new API) andsplit(by:)(legacy fallback):While visionOS 1.0+ would always take the if branch at runtime, Swift still type-checks the else branch at compile time, causing an error because
split(by:)is marked unavailable for visionOS.Solution
Replaced the inline conditional with a new
splitData(_:separator:)helper that uses#if os(visionOS)compile-time conditional to completely exclude the legacy code path on visionOS builds:Test Plan
EventParserTeststo ensure parsing behavior unchanged