Skip to content

Replace platforms: block with per-API @available annotations#6

Merged
rnro merged 1 commit into
apple:mainfrom
rnro:availability
Jun 11, 2026
Merged

Replace platforms: block with per-API @available annotations#6
rnro merged 1 commit into
apple:mainfrom
rnro:availability

Conversation

@rnro

@rnro rnro commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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).

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`).

@baumanl baumanl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@baumanl baumanl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @tommy offline. LGTM

@rnro rnro merged commit 7e8eb61 into apple:main Jun 11, 2026
19 checks passed
@rnro rnro deleted the availability branch June 11, 2026 08:25
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.

4 participants