Use anyAppleOS availability (UseAnyAppleOSAvailability)
An opt-in warning that suggests replacing a group of per-platform @available specifications with a single anyAppleOS specification when the platforms share the same introduced version.
Overview
anyAppleOS is a meta-platform that covers all Apple platforms using unified versioning starting at 26.0. When a declaration is available on at least macOS, iOS, tvOS, and watchOS at the same introduced version, a single anyAppleOS specification expresses the same intent more concisely.
This warning is opt-in and disabled by default. Enable it with:
-Wwarning UseAnyAppleOSAvailabilityor promote it to an error with -Werror UseAnyAppleOSAvailability.
Examples
Short-form grouped availability:
@available(macOS 26, iOS 26, tvOS 26, watchOS 26, *)
func foo() {} // warning: use '@available(anyAppleOS 26, *)' instead of platform specific '@available' attributes with the same version
// Suggested replacement
@available(anyAppleOS 26, *)
func foo() {}See Also
@dynamicCallable implementation requirements (DynamicCallable)Add @preconcurrency import (AddPreconcurrencyImport)Always enabled availability domains (AlwaysAvailableDomain)Argument matching for trailing closures (TrailingClosureMatching)Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)Captures in a `@Sendable` closure (SendableClosureCaptures)Compilation caching (CompilationCaching)Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)Cross-isolation data race (RegionIsolationCrossIsolationDataRace)Deprecated declaration warnings (DeprecatedDeclaration)Deprecated implementation-only imports (ImplementationOnlyDeprecated)Dynamic exclusivity (DynamicExclusivity)Embedded Swift language restrictions (EmbeddedRestrictions)