Skip to content

Fix watchOS build failure on Xcode 27 - #52

Merged
Recouse merged 1 commit into
Recouse:mainfrom
maximbilan:fix/xcode-27-watchos-availability
Aug 27, 2026
Merged

Fix watchOS build failure on Xcode 27#52
Recouse merged 1 commit into
Recouse:mainfrom
maximbilan:fix/xcode-27-watchos-availability

Conversation

@maximbilan

Copy link
Copy Markdown
Contributor

Problem

The package fails to compile for watchOS with Xcode 27 beta:

Sources/EventSource/EventParser.swift:91:25: error: 'split(by:)' is unavailable in watchOS:
This method is not recommended on watchOS 9.0+
note: 'split(by:)' was obsoleted in watchOS 9.0

Cause

Xcode 27 raises the minimum supported deployment targets, so the floors declared in Package.swift get clamped upward:

Platform Xcode 26 min Xcode 27 min obsoleted: at Result
watchOS 4.0 9.0 9.0 error
iOS 12.0 15.0 16.0 ok
tvOS 12.0 15.0 16.0 ok
macOS 10.13 12.0 13.0 ok

Package.swift declares .watchOS(.v6), so Xcode 26 compiled with -target arm64-apple-watchos6.0 and the fallback was legal. Xcode 27 clamps to watchos9.0, which meets obsoleted: 9.0 exactly and makes the symbol a hard error.

Being inside the else of if #available(..., watchOS 9.0, *) does not rescue it — an #available else branch does not lower the availability context, so the call is still checked against the deployment target.

Fix

Remove the @available attributes from the fileprivate fallback and rename it legacySplit(by:). They were decorative on a method nothing outside the file could call, but they broke the build. This also removes the need for the #if os(visionOS) special case added in 1c45c73, which worked around the same root cause on a different platform.

iOS and macOS are only one OS release away from the same collision (clamped to 15.0/12.0 against obsoleted: 16.0/13.0), so removing the annotations rather than bumping them should prevent a repeat on the next toolchain.

Deployment targets in Package.swift are unchanged — not a breaking change for consumers.

Verification

  • Clean builds on watchOS, iOS, tvOS, visionOS, macOS under Xcode 27.0 beta (27A5252f)
  • Still builds under Xcode 26.6
  • All 7 tests pass

One note: the fallback path isn't exercised by the test suite — #available takes the modern branch on the test host — but the body is byte-identical to before, only renamed.

🤖 Generated with Claude Code

Xcode 27 raises the minimum watchOS deployment target from 4.0 to 9.0, so
the package's declared `.watchOS(.v6)` floor is clamped up to 9.0. That
collides exactly with the `obsoleted: 9.0` annotation on the private
`split(by:)` back-deployment fallback:

    error: 'split(by:)' is unavailable in watchOS:
    This method is not recommended on watchOS 9.0+

Sitting in the `else` of `if #available(..., watchOS 9.0, *)` does not help:
an `#available` else branch does not lower the availability context, so the
call is still checked against the deployment target and rejected.

Drop the `@available` attributes from the helper and rename it to
`legacySplit(by:)`. They were decorative on a fileprivate method nothing
outside the file could call, but they broke the build. This also removes the
need for the `#if os(visionOS)` special case added in 1c45c73, which worked
around the same root cause.

iOS and macOS are one OS release from hitting this too (clamped to 15.0/12.0
against `obsoleted:` 16.0/13.0), so removing the annotations avoids a repeat
on the next toolchain.

Deployment targets in Package.swift are unchanged; this is not a breaking
change for consumers.

Verified: clean builds on watchOS, iOS, tvOS, visionOS and macOS under
Xcode 27.0 beta (27A5252f); still builds under Xcode 26.6; all 7 tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@maximbilan
maximbilan requested a review from Recouse as a code owner August 26, 2026 09:05
@Recouse
Recouse merged commit 2fc1977 into Recouse:main Aug 27, 2026
3 checks passed
@Recouse

Recouse commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Thank you!

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.

2 participants