# Introducing anyAppleOS

**URL:** <https://forums.swift.org/t/introducing-anyappleos/85728>\
**Category:** Platform\
**Tags:** availability\
**Created:** [March 31, 2026, 4:05pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728 "2026-03-31T16:05:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tshortli](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tshortli/32/15850_2.png) [@tshortli](https://forums.swift.org/u/tshortli)\
**Post date:** [March 31, 2026, 4:05pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/1 "2026-03-31T16:05:36Z")

</div>

Apple recently unified its operating system versioning by adopting year-based version numbers for the major releases of macOS, iOS, watchOS, tvOS, and visionOS. The operating systems that shipped in fall of 2025 all have an aligned version number of 26.0. Starting with the Swift 6.4 compiler, we’re taking advantage of this cross-platform version number alignment by introducing a new availability “platform” called `anyAppleOS`. This change will allow you to avoid boilerplate code when using new APIs and building for multiple Apple platforms.

To illustrate the improvement, here’s an example of code that iterates through a string's Unicode scalars via its `utf8Span` property:

```swift
// Swift Standard Library
extension String {
  @available(macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0, *)
  public var utf8Span: UTF8Span
}

// Example
func printScalarValues(_ string: borrowing String) {
  if #available(macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0, *) {
    var iterator = string.utf8Span.makeUnicodeScalarIterator()
    while let scalar = iterator.next() {
      print(scalar.escaped(asASCII: true))
    }
  } else {
    // Fallback on earlier versions...
  }
}

printScalarValues("🎉") // Prints \u{0001F389}

```

Since this code deploys to older versions of all of Apple’s operating systems, an `if #available` check specifying five different operating system versions is needed to handle the case where `String.utf8Span` is not available at runtime. Using `anyAppleOS` we can simplify both the `utf8Span` declaration and the `if #available` check:

```swift
// Swift Standard Library
extension String {
  @available(anyAppleOS 26.0, *) // 🆕
  public var utf8Span: UTF8Span
}

// Example
func printScalarValues(_ string: borrowing String) {
  if #available(anyAppleOS 26.0, *) { // 🆕
    var iterator = string.utf8Span.makeUnicodeScalarIterator()
    while let scalar = iterator.next() {
      print(scalar.escaped(asASCII: true))
    }
  } else {
    // Fallback on earlier versions...
  }
}

```

### Source compatibility

Availability specified using `anyAppleOS` is interchangeable with platform-specific availability. For example, when compiling Swift code for macOS, code guarded by macOS 26 availability can use declarations that are available in `anyAppleOS` 26 and vice-versa:

```swift
@available(macOS 26.0, *)
func availableInMacOS26()

@available(anyAppleOS 26.0, *)
func availableInAnyAppleOS26()

if #available(macOS 26.0, *) {
  availableInMacOS26() // ✅
  availableInAnyAppleOS26() // ✅ when building for macOS
}

if #available(anyAppleOS 26.0, *) {
  availableInMacOS26() // ✅
  availableInAnyAppleOS26() // ✅
 } 

```

This means that library authors can adopt `anyAppleOS` to simplify their API declarations without breaking source compatibility and API users can adopt `anyAppleOS` without waiting for updates to libraries.

Since the OS version alignment starts at version 26.0, it is invalid to specify an `anyAppleOS` version lower than 26.0:

```swift
if #available(anyAppleOS 25.0, *) { } // ❌ error: '25.0' is not a valid version number for any Apple OS

```

### **Combining `anyAppleOS` and platform-specific availability**

For some Apple platforms, Swift infers availability when it isn’t explicitly specified. For example, by default macCatalyst and visionOS availability are inferred from iOS availability:

```swift
@available(iOS 18.0, *) // Inferred: macCatalyst 18.0, visionOS 2.0
func availableIniOS18()

```

This inference can be overridden by specifying explicit availability for those platforms instead:

```swift
@available(iOS 18.0, macCatalyst 18.1, visionOS 2.1, *)
func explicitAvailability()

```

As a general rule, when availability for multiple platforms is specified simultaneously, the compiler prefers the specification for the most specific platform that matches the compilation target.

Availability specified using `anyAppleOS` works the same way. The compiler infers platform-specific availability from `anyAppleOS` availability, but this inference can be overridden. For example, imagine an API that is introduced first on macOS 26, iOS 26, and visionOS 26 but is not initially available on either watchOS or tvOS:

```swift
@available(anyAppleOS 26.0, *)
@available(watchOS, unavailable)
@available(tvOS, unavailable)
public func newAPI()

```

If support for these APIs were added later in watchOS 26.4 and tvOS 26.4, the availability attributes could be updated like this:

```swift
@available(anyAppleOS 26.0, watchOS 26.4, tvOS 26.4, *)
public func newAPI()

```

### Conditional compilation

`anyAppleOS` can be specified as an argument to `#if os(...)`, simplifying conditional compilation in cross-platform code:

```swift
// Before
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
// ... code specific to macOS, iOS, watchOS, tvOS, or visionOS
#endif

// After
#if os(anyAppleOS)
// ... code specific to macOS, iOS, watchOS, tvOS, or visionOS
#endif

```

### Interoperability

Clang will also support `anyAppleOS` availability, bringing the same availability simplification to C, Obj-C, and C++:

```swift
// Before
__attribute__ ((availability(macOS, introduced=26.0)))
__attribute__ ((availability(iOS, introduced=26.0)))
__attribute__ ((availability(watchOS, introduced=26.0)))
__attribute__ ((availability(tvOS, introduced=26.0)))
__attribute__ ((availability(visionOS, introduced=26.0)))
@interface NewIn26
// ...
@end

// After
__attribute__ ((availability(anyAppleOS, introduced=26.0)))
@interface NewIn26
// ...
@end

```

Clang availability attributes that specify `anyAppleOS` availability are imported into Swift as you would expect.

### **Trying it out**

`anyAppleOS` support is available for you to try in the latest [Swift.org](http://swift.org/) toolchain [snapshots](https://www.swift.org/install/macos/#development-snapshots) built from `main`.

---

<div class="post-metadata">

**Author:** ![pyrtsa](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pyrtsa/32/740_2.png) [@pyrtsa](https://forums.swift.org/u/pyrtsa)\
**Post date:** [March 31, 2026, 5:43pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/2 "2026-03-31T17:43:43Z")

</div>

I couldn't find it mentioned, is it possible to also express `deprecated` and `obsoleted` versions using `anyAppleOS`?

```swift
@available(anyAppleOS, introduced: 26.0, deprecated: 26.2, obsoleted: 26.4)
func shortLivedAPI() {

}

```

I think the rules, including overrides, would behave the same way as for just `introduced`!

---

<div class="post-metadata">

**Author:** ![tshortli](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tshortli/32/15850_2.png) [@tshortli](https://forums.swift.org/u/tshortli)\
**Post date:** [March 31, 2026, 5:45pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/3 "2026-03-31T17:45:20Z")

</div>

Yes, your example would work as intended.

---

<div class="post-metadata">

**Author:** ![pyrtsa](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pyrtsa/32/740_2.png) [@pyrtsa](https://forums.swift.org/u/pyrtsa)\
**Post date:** [March 31, 2026, 5:52pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/4 "2026-03-31T17:52:48Z")

</div>

Does this share any implementation details with the `AvailabilityMacro` experimental feature? Because the last time I tried, that did not play well with `deprecated` or `obsoleted`.

It would be very nice being able to define one's own "any Apple OS" shorthands for pre-26.0 OS versions, too.

Even better if `@available(anyAppleOS 25.0, *)` could magically mean `@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)` somehow, etc!

---

<div class="post-metadata">

**Author:** ![tshortli](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tshortli/32/15850_2.png) [@tshortli](https://forums.swift.org/u/tshortli)\
**Post date:** [March 31, 2026, 6:13pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/5 "2026-03-31T18:13:47Z")

</div>

> Does this share any implementation details with the `AvailabilityMacro` experimental feature?

No, `anyAppleOS` support doesn't depend on the implementation of the experimental `AvailabilityMacro` feature. `anyAppleOS` is modeled as a distinct platform in the Swift compiler and there is no implicit macro expansion to platform-specific availability attributes happening. There is existing infrastructure for hierarchical platform availability inference that `anyAppleOS` leverages. You can visualize the relationship between Apple platform availability domains as a tree like this:

```swift
                anyAppleOS
        ┌────────┬──┴──┬──────────────┐
        │ │ │ │
     watchOS macOS tvOS iOS
        │ │ │ ┌──────┼───────────┐
     watchOS macOS tvOS │ │ │
     AppExt AppExt AppExt iOS visionOS macCatalyst
                             AppExt │ │
                                   visionOS macCatalyst
                                    AppExt AppExt

```

Each downward edge represents a relationship in which availability can be inferred from the platform above. The change is that `anyAppleOS` has been inserted into the hierarchy above `watchOS`, `macOS`, `tvOS`, and `iOS`.

---

<div class="post-metadata">

**Author:** ![CharlesS](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/charless/32/6488_2.png) [@CharlesS](https://forums.swift.org/u/CharlesS)\
**Post date:** [April 1, 2026, 4:08am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/6 "2026-04-01T04:08:50Z")

</div>

Thanks, this is a _massively_ appreciated. If I had to quibble about something, I’d think `Darwin` would probably be cleaner than `anyAppleOS`, especially since we already use `Darwin` as the import for common low-level routines for Apple operating systems, but let’s get real; _anything_ is better than `@available(macOS x.y, macCatalyst x.y, iOS x.y, tvOS x.y, watchOS x.y, visionOS x.y, carOS x.y, brainOS x.y, skynetOS x.y, apocalOS x.y, whateverElseIsNextOS x.y, etcOS x.y, *)`.

---

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [April 1, 2026, 11:51am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/7 "2026-04-01T11:51:14Z")

</div>

> [@CharlesS](#):
>
> If I had to quibble about something, I’d think `Darwin` would probably be cleaner than `anyAppleOS`, especially since we already use `Darwin` as the import for common low-level routines for Apple operating systems

Unfortunately that would draw connections to the Darwin kernel, which has its own distinct version numbering scheme that doesn't quite line up with the user-facing OS. For example, when I run `uname -r` on macOS Tahoe 26.3.1, the output is `25.3.0`.

---

<div class="post-metadata">

**Author:** ![CharlesS](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/charless/32/6488_2.png) [@CharlesS](https://forums.swift.org/u/CharlesS)\
**Post date:** [April 1, 2026, 12:55pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/8 "2026-04-01T12:55:29Z")

</div>

But that used to be true of macOS and iOS too. No reason Darwin couldn’t get a little bump to its version number to get it lined up too. 🙂

---

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [April 1, 2026, 12:57pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/9 "2026-04-01T12:57:31Z")

</div>

Sure, but we have to review the `anyAppleOS` pitch in the current reality where the numbers don't match up, and the Swift evolution process doesn't have any control over how Darwin kernel version numbers are determined.

---

<div class="post-metadata">

**Author:** ![Cyberbeni](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/cyberbeni/32/46241_2.png) [@Cyberbeni](https://forums.swift.org/u/Cyberbeni)\
**Post date:** [April 1, 2026, 3:24pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/10 "2026-04-01T15:24:41Z")

</div>

Will SPM also add this?

> **[SupportedPlatform | Apple Developer Documentation](https://developer.apple.com/documentation/packagedescription/supportedplatform)**
>
> A platform that the Swift package supports.

> **[Platform | Apple Developer Documentation](https://developer.apple.com/documentation/packagedescription/platform)**
>
> A platform supported by Swift Package Manager.

---

<div class="post-metadata">

**Author:** ![matthewruzzi](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@matthewruzzi](https://forums.swift.org/u/matthewruzzi)\
**Post date:** [April 1, 2026, 9:15pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/11 "2026-04-01T21:15:58Z")

</div>

If we used Darwin as the version number this would allow referencing older versions of Apple's software for example Darwin 24 would be macOS 15, iOS 18, etc.

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [April 1, 2026, 11:42pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/12 "2026-04-01T23:42:19Z")

</div>

Do people really think "Darwin" means the same thing as "any [modern] Apple OS"? I doubt most developers know what it refers to. The `Darwin` module present on Apple's OSs doesn't really mean anything other than `ExtendedPOSIXAPIs`, and plenty of Apple-OS-only projects probably get by without mentioning it at all. Furthermore, Clang and GCC have long treated `darwin` as an alias for `macos` in extended target triples (usually with altered understandings of version numbers), and this convention has extended out to plenty of projects across the internet thanks to it showing up in the `uname` command on macOS (to pick just two big ones, [Python](https://docs.python.org/3/library/sys.html#sys.platform) and [Node.js](https://nodejs.org/docs/latest/api/os.html#osplatform)).

It may be kind of clunky, but I'd go for the relatively clear `anyAppleOS`\* over what's basically a legacy name that nobody uses in casual speech to refer to e.g. tvOS.

\* If Apple ever releases an OS that _isn't_ based on their general existing SDK, this might get confusing. But if Apple releases an OS that _does_ provide their general SDK shape, but, say, changes out the kernel, is that still "Darwin"?

---

<div class="post-metadata">

**Author:** ![Nevin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nevin/32/617_2.png) [@Nevin](https://forums.swift.org/u/Nevin)\
**Post date:** [April 2, 2026, 1:10am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/13 "2026-04-02T01:10:55Z")

</div>

> [@jrose](#):
>
> I'd go for the relatively clear `anyAppleOS`

[_Whaddayamean “any”?_](https://forums.swift.org/t/swift-on-mac-os-9/35019)

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [April 2, 2026, 3:34am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/14 "2026-04-02T03:34:36Z")

</div>

> [@tshortli](#):
>
> anyAppleOS

Is anyAppleOS considered final, or is naming still open for discussion?

I’m a bit concerned about the "any" prefix here, since it already has a well-established meaning in Swift (existentials), which could be slightly confusing in this context.

Personally, I’d prefer:

```swift
@available(appleOS 26.0, *)

```

as it feels more consistent with the existing style of:

```swift
@available(macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0, *)

```

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [April 2, 2026, 3:37am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/15 "2026-04-02T03:37:08Z")

</div>

> [@tshortli](#):
>
> ```swift
> // Before
> #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
> // ... code specific to macOS, iOS, watchOS, tvOS, or visionOS
> #endif
> 
> // After
> #if os(anyAppleOS)
> // ... code specific to macOS, iOS, watchOS, tvOS, or visionOS
> #endif
> 
> ```

Cool. We can finally replace the wrong `#if canImport(Darwin)` check everywhere since it can also indicate other Darwin kernel OS but is not appleOS.

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [April 2, 2026, 3:53am UTC](https://forums.swift.org/t/introducing-anyappleos/85728/16 "2026-04-02T03:53:36Z")

</div>

> [@pyrtsa](#):
>
> Does this share any implementation details with the `AvailabilityMacro` experimental feature?

No. But you can also use this to simplify future\* AvailabilityMacro.

Eg.

```swift
AvailabilityMacro=FeatureA:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0
...
AvailabilityMacro=FeatureB:macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0

```

For `FeatureB` you may want to update to use `AvailabilityMacro=FeatureB:anyAppleOS 26.0` instead.

---

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [April 2, 2026, 5:24pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/17 "2026-04-02T17:24:51Z")

</div>

> [@Kyle-Ye](#):
>
> Is anyAppleOS considered final, or is naming still open for discussion?

It bears clarifying that this decision was reserved to the project sponsor (Apple) as owner of the various trade names and final arbiter of the taxonomy of its platforms. This thread is an announcement, not a pitch—the feature was pitched already as `os(Darwin)`.

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [April 2, 2026, 7:11pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/18 "2026-04-02T19:11:10Z")

</div>

> [@Kyle-Ye](#):
>
> Is anyAppleOS considered final, or is naming still open for discussion?

If it's open for discussion I'd say just "appleOS" (unless "appleOS" is planned for something else).

---

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [April 2, 2026, 7:24pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/19 "2026-04-02T19:24:24Z")

</div>

Just to reiterate Xiaodi's point above, the name for this is entirely Apple's choice _as a vendor_ since it is a reference to their trademarks and operating system families. Whenever new operating systems are brought up and support is added to Swift, we don't debate or bikeshed how we represent those in compiler conditions (note that this thread is explicitly not in the Evolution subforum).

Instead, we defer to those vendors, often by simply adopting the canonical name for that OS. To wit, when Apple launched visionOS, there was no pitch or discussion about how to spell `os(visionOS)`. This is a more complicated case since it represents a family of operating systems, but the same philosophy applies here—as the vendor, it is their choice to make.

---

<div class="post-metadata">

**Author:** ![mattneub](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mattneub/32/1924_2.png) [@mattneub](https://forums.swift.org/u/mattneub)\
**Post date:** [April 2, 2026, 7:48pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728/20 "2026-04-02T19:48:08Z")

</div>

This announcement came on a certain date that made me immediately doubt its veracity...

[Next page](https://forums.swift.org/t/introducing-anyappleos/85728.md?page=2)
