Simpler availability

anyAppleOS availability

Swift 6.4 adds anyAppleOS to the @available attribute, letting you describe APIs that become available across all Apple platforms at the same OS version.

Before Swift 6.4

Availability often had to list every Apple platform individually, and each platform could have a different version number:

@available(
    iOS 18,
    macOS 15,
    tvOS 18,
    watchOS 11,
    visionOS 2,
    *
)
func myMethod() {
    print("Subscribe!")
}

That gets harder to scan as more platforms are added.

Swift 6.4

With Apple’s newer year-based OS versioning, APIs that become available on all Apple platforms in the same release can use one shared value:

@available(
    anyAppleOS 26,
    *
)
func myMethod() {
    print("Subscribe!")
}

Use anyAppleOS when the same availability version applies to all Apple platforms. If a platform needs a different version, keep listing the platforms explicitly.

Reference