Replace platforms: block with per-API @available annotations#6
Merged
Conversation
The `platforms:` block in `Package.swift` sets a *OS 26
deployment-target floor for the package and transitively any downstream
package. Requiring this for any downstream package is an onerous
constraint and we should avoid it if possible.
This change drops the `platforms: [.macOS("26.0"), ...]` block from
`Package.swift` and annotates availability where necessary.
The annotations changes broadly fall into these categories:
* Mark with `@available(SwiftTLS 0.1.0, *)` (= macOS 26 / iOS 26 / tvOS
26 / watchOS 26 / visionOS 26) every top-level declaration in
`Sources/` and `Tests/` whose body uses an OS-26+ feature or another
`@available(SwiftTLS 0.1.0, *)` symbol.
* Use `@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)` on
`os.Logger(subsystem:category:)` initializers in Darwin branches and
on extensions of `HKDF` (the actual binding constraint for those APIs).
* Use `@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)` on
extensions of `HashFunction`/`HMAC` and on the `SymmetricKey`
typealiases / `EncryptionLevel`.
* Wire `availabilityMacros` into the test target's `swiftSettings` so
the `SwiftTLS 0.1.0` macro is defined when building tests, and update
the test annotations accordingly (replacing the placeholder
`@available(iOS 27.0, *)` on `SwiftTLSProtocolTests`).
tfpauly
approved these changes
Jun 10, 2026
baumanl
requested changes
Jun 10, 2026
baumanl
left a comment
Collaborator
There was a problem hiding this comment.
Marking as needs changes because I don't understand why this is needed. If they are package internal, why do they need API availability annotations?
agnosticdev
approved these changes
Jun 10, 2026
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.
The
platforms:block inPackage.swiftsets a *OS 26 deployment-target floor for the package and transitively any downstream package. Requiring this for any downstream package is an onerous constraint and we should avoid it if possible.This change drops the
platforms: [.macOS("26.0"), ...]block fromPackage.swiftand annotates availability where necessary.The annotations changes broadly fall into these categories:
@available(SwiftTLS 0.1.0, *)(= macOS 26 / iOS 26 / tvOS 26 / watchOS 26 / visionOS 26) every top-level declaration inSources/andTests/whose body uses an OS-26+ feature or another@available(SwiftTLS 0.1.0, *)symbol.@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)onos.Logger(subsystem:category:)initializers in Darwin branches and on extensions ofHKDF(the actual binding constraint for those APIs).@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)on extensions ofHashFunction/HMACand on theSymmetricKeytypealiases /EncryptionLevel.availabilityMacrosinto the test target'sswiftSettingsso theSwiftTLS 0.1.0macro is defined when building tests, and update the test annotations accordingly (replacing the placeholder@available(iOS 27.0, *)onSwiftTLSProtocolTests).