Repository navigation
Remove the breaking changes so the next release can be 2.1.0 - #454
Merged
Merged
Conversation
The Swift 6 work changed two things in the SwiftUI module that Swift 6 adoption did not require. Both were breaking, and together they forced a major release days after 2.0.0 shipped. PhoneNumberFieldState.error was narrowed from an existential Error to a PhoneNumberValueError. That made the state Sendable and its Equatable conformance synthesized, but it also discarded information: callers previously received the NSError raised by the Objective-C core and could read its domain, code, and userInfo, where the enum preserves only a description string. Restore the existential, and with it the custom equality that compares error descriptions. PhoneNumberEnriching gained a Sendable requirement, which invalidates any conformance capturing non-Sendable state. Drop it, along with the conformance it enabled on PhoneNumberFieldFormatter. None of this was load-bearing. The six statics that were errors in the Swift 6 language mode -- the five facade shared instances and PhoneNumberFieldStyle.automatic -- are all fixed by purely additive Sendable conformances, which stay. The package still builds clean in the Swift 6 language mode. Callers that need field state across a concurrency domain should derive a PhoneNumberValue, which is Sendable; the test and the changelog say so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Removes the two breaking changes that landed in #452, so the next release can be 2.1.0 instead of a major published days after 2.0.0.
Neither was required for Swift 6 adoption. All six statics that were errors in the Swift 6 language mode — the five facade
sharedinstances andPhoneNumberFieldStyle.automatic— are fixed by purely additiveSendableconformances, which stay. The package still builds clean in the Swift 6 language mode with zero warnings.Why not just number it 2.1.0 as-is
The podspecs depend on each other with
~> 2.0.1and the README documents~> 2.0. Shipping breaking changes as 2.1.0 means every consumer on~> 2.0picks them up on a routine update and finds out at compile time. The version number has to match the compatibility, so the fix is to remove the incompatibility.What is reverted
PhoneNumberFieldState.errorgoes back toError?. Narrowing it toPhoneNumberValueErrormade the stateSendableand itsEquatableconformance synthesized, but it discarded information: callers previously received theNSErrorraised by the Objective-C core and could read itsdomain,code, anduserInfo, where the enum preserves only a description string. The custom equality that compares error descriptions comes back with it.PhoneNumberEnrichingloses itsSendablerequirement, along with thePhoneNumberFieldFormatterconformance it enabled. A protocol requirement added to a published protocol invalidates any conformance capturing non-Sendablestate.PhoneNumberFieldStateis therefore notSendable. Callers who need field state across a concurrency domain should derive aPhoneNumberValue, which is; the updated test demonstrates it and the changelog says so.What is kept
Everything else from #452: the Swift 6 language mode, the tools-version bump, visionOS, all five facade
Sendableconformances,PhoneNumberFieldStyle: Sendable, thePhoneNumberValueErrorimprovements, the deprecation ofPhoneNumberError, the test suites, the CI matrix, and the docs.Remaining compatibility note
swift-tools-version:6.0raises the minimum toolchain for Swift Package Manager consumers to Xcode 16. Deployment targets are unchanged and the CocoaPods specs accept Swift 5.9 or 6.0, so CocoaPods users are unaffected. This is documented at the top of the changelog's unreleased section rather than buried in a bullet.Tests
swift build— Swift 6 language mode, 0 warningsswift test— 231 XCTest + 43 Swift Testing, 0 failuresgit diff --checkNotes
CHANGELOG.mdis rewritten from "must be published as a major version" to a minor release, and theSendablebullet now states which type is deliberately notSendableand what to use instead.Sendableprotocol requirement, close this and release 3.0.0 instead. The trade is a stricter API against a major version bump one release after 2.0.0.🤖 Generated with Claude Code