# \#availability

**URL:** https://forums.swift.org/tag/availability/88.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Supporting @available stored properties](https://forums.swift.org/t/supporting-available-stored-properties/89024)

<div class="topic-metadata">

**Author:** [@mattie](https://forums.swift.org/u/mattie)\
**Replies:** 3\
**Last updated:** [August 17, 2026, 8:39pm UTC](https://forums.swift.org/t/supporting-available-stored-properties/89024 "2026-08-17T20:39:19Z")

</div>

I ran into an issue with someone today. I think this code represents the issue pretty closely. @available(anyAppleOS 27.0, \*) struct SomeBrandNewType { } struct AdoptingType { // error: Stored properties cannot be ma…

---

## [Introducing anyAppleOS](https://forums.swift.org/t/introducing-anyappleos/85728)

<div class="topic-metadata">

**Author:** [@tshortli](https://forums.swift.org/u/tshortli)\
**Replies:** 28\
**Last updated:** [April 6, 2026, 7:05pm UTC](https://forums.swift.org/t/introducing-anyappleos/85728 "2026-04-06T19:05:53Z")

</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…

---

## [\`@available(\*, unavailable)\` enum cases and switch exhaustiveness](https://forums.swift.org/t/available-unavailable-enum-cases-and-switch-exhaustiveness/85471)

<div class="topic-metadata">

**Author:** [@devioustree](https://forums.swift.org/u/devioustree)\
**Replies:** 3\
**Last updated:** [March 21, 2026, 12:52pm UTC](https://forums.swift.org/t/available-unavailable-enum-cases-and-switch-exhaustiveness/85471 "2026-03-21T12:52:30Z")

</div>

I stumbled across something unexpected with @available(\*, unavailable) on enum cases and wanted to check whether this is intentional or not. Given this somewhat philosophical enum: enum Availability { @available(\*,…

---

## [\[Pitch\] Extensible availability checking](https://forums.swift.org/t/pitch-extensible-availability-checking/79308)

<div class="topic-metadata">

**Author:** [@tshortli](https://forums.swift.org/u/tshortli)\
**Replies:** 20\
**Last updated:** [January 15, 2026, 2:14pm UTC](https://forums.swift.org/t/pitch-extensible-availability-checking/79308 "2026-01-15T14:14:32Z")

</div>

Swift gives developers a way to limit the use of declarations in certain contexts using the @available attribute. For example, a library developer can specify that a new API is only available at runtime on macOS 15 or ne…

---

## [\[Pitch\] Swift runtime availability](https://forums.swift.org/t/pitch-swift-runtime-availability/82742)

<div class="topic-metadata">

**Author:** [@tshortli](https://forums.swift.org/u/tshortli)\
**Replies:** 25\
**Last updated:** [November 1, 2025, 1:27am UTC](https://forums.swift.org/t/pitch-swift-runtime-availability/82742 "2025-11-01T01:27:53Z")

</div>

Hey folks, I've written a pitch related to extending Swift's availability checking to accommodate an ABI stable Swift runtime on non-Apple platforms. Here's a snippet from the Motivation section: In the future, Swift …

---

## [\#unavailable control flow requires else?](https://forums.swift.org/t/unavailable-control-flow-requires-else/82809)

<div class="topic-metadata">

**Author:** [@wes1](https://forums.swift.org/u/wes1)\
**Replies:** 1\
**Last updated:** [October 22, 2025, 10:26pm UTC](https://forums.swift.org/t/unavailable-control-flow-requires-else/82809 "2025-10-22T22:26:26Z")

</div>

\#unavailable seems to require an else clause for the available-availing code, which creates unnecessary indentation; as a precondition, there’s typically a lot of code affected. It would be nice if the control-transfer …

---

## [Diagnostics for unavailable declarations](https://forums.swift.org/t/diagnostics-for-unavailable-declarations/82281)

<div class="topic-metadata">

**Author:** [@crontab](https://forums.swift.org/u/crontab)\
**Replies:** 1\
**Last updated:** [September 22, 2025, 4:39pm UTC](https://forums.swift.org/t/diagnostics-for-unavailable-declarations/82281 "2025-09-22T16:39:46Z")

</div>

Sometimes during refactoring I mark certain declarations as unavailable to keep the definition (function, class, etc) in the source but have the compiler take me to the places where it's used. However, the compiler is n…

---

## [Question about available macro warning not working as expected](https://forums.swift.org/t/question-about-available-macro-warning-not-working-as-expected/64755)

<div class="topic-metadata">

**Author:** [@mackoj](https://forums.swift.org/u/mackoj)\
**Replies:** 7\
**Last updated:** [August 11, 2025, 4:34pm UTC](https://forums.swift.org/t/question-about-available-macro-warning-not-working-as-expected/64755 "2025-08-11T16:34:09Z")

</div>

Hello everyone, I'm writing to report an issue our team has encountered with the Swift API that is causing compatibility problems. We're eager to enable our users to enjoy new APIs, but we've run into a bug with the ava…

---

## [Contradictory \`@available\`s are required?](https://forums.swift.org/t/contradictory-available-s-are-required/78831)

<div class="topic-metadata">

**Author:** [@bbrk24](https://forums.swift.org/u/bbrk24)\
**Replies:** 1\
**Last updated:** [March 26, 2025, 5:27am UTC](https://forums.swift.org/t/contradictory-available-s-are-required/78831 "2025-03-26T05:27:11Z")

</div>

I'm working on some code that uses UIBarButtonItem.flexibleSpace (introduced in iOS 14 and tvOS 14) and UIToolbar (doesn't exist in tvOS). Turns out those availabilities interact in a very unintuitive way: the required a…

---

## [Improved @available macro](https://forums.swift.org/t/improved-available-macro/77439)

<div class="topic-metadata">

**Author:** [@MinerMinerMain](https://forums.swift.org/u/MinerMinerMain)\
**Replies:** 0\
**Last updated:** [January 24, 2025, 7:22pm UTC](https://forums.swift.org/t/improved-available-macro/77439 "2025-01-24T19:22:48Z")

</div>

I would like to modify the @available macro to be easier to read and more enforceable by the compiler. First I would like to go over the parameters you can provide to this new version: Build Group: this can be a platfo…

---

## [@backDeployed is operating as an override instead of only for use in unsupported platforms versions](https://forums.swift.org/t/backdeployed-is-operating-as-an-override-instead-of-only-for-use-in-unsupported-platforms-versions/68071)

<div class="topic-metadata">

**Author:** [@NSProgrammer](https://forums.swift.org/u/NSProgrammer)\
**Replies:** 13\
**Last updated:** [October 26, 2023, 7:36pm UTC](https://forums.swift.org/t/backdeployed-is-operating-as-an-override-instead-of-only-for-use-in-unsupported-platforms-versions/68071 "2023-10-26T19:36:31Z")

</div>

We have been facing a lot of headaches recently from unexpected behavior of APIs that we have @backDeployed since Xcode 15 and iOS 17 released. Long story short, I've uncovered that any API that we @backDeployed is bein…

---

## [Windows and Availability API](https://forums.swift.org/t/windows-and-availability-api/64988)

<div class="topic-metadata">

**Author:** [@STREGAsGate](https://forums.swift.org/u/STREGAsGate)\
**Replies:** 9\
**Last updated:** [May 15, 2023, 3:58pm UTC](https://forums.swift.org/t/windows-and-availability-api/64988 "2023-05-15T15:58:26Z")

</div>

I've run into an issue where the representation of code in WinSDK is mangled when using Windows SDK later than 10.0.19041. I'm not sure exactly which version it starts at yet. I've been using the official getting starte…

---

## [How to exclude unavailable classes from compilation based on the target OS](https://forums.swift.org/t/how-to-exclude-unavailable-classes-from-compilation-based-on-the-target-os/63340)

<div class="topic-metadata">

**Author:** [@myintruder](https://forums.swift.org/u/myintruder)\
**Replies:** 2\
**Last updated:** [February 24, 2023, 4:34pm UTC](https://forums.swift.org/t/how-to-exclude-unavailable-classes-from-compilation-based-on-the-target-os/63340 "2023-02-24T16:34:36Z")

</div>

I have a class that's unavailable on iOS, so I annotated it with @available, but the compiler still complains that some symbol is not available on iOS. I even added the annotation to the method itself, but no luck. How …

---

## [Availability of TaskLocal](https://forums.swift.org/t/availability-of-tasklocal/62928)

<div class="topic-metadata">

**Author:** [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Replies:** 1\
**Last updated:** [February 3, 2023, 11:36am UTC](https://forums.swift.org/t/availability-of-tasklocal/62928 "2023-02-03T11:36:12Z")

</div>

I'm getting a crash on iOS 14.2.0 when app tries to access a @TaskLocal variable: public class Clock { @TaskLocal public static var current: Clock = SystemClock() public var now: Date { fata…

---

## [Availability when using Library evolution/ resilience for third party libraries](https://forums.swift.org/t/availability-when-using-library-evolution-resilience-for-third-party-libraries/59341)

<div class="topic-metadata">

**Author:** [@hassila](https://forums.swift.org/u/hassila)\
**Replies:** 5\
**Last updated:** [August 9, 2022, 4:36pm UTC](https://forums.swift.org/t/availability-when-using-library-evolution-resilience-for-third-party-libraries/59341 "2022-08-09T16:36:29Z")

</div>

So, we’ve ended up realizing we’d like to use the library evolution features for resilient api surfaces for our product (yes, needed for an enterprise solution where clients of libraries must be able to be replaced indep…

---

## [CaseIterable and @available](https://forums.swift.org/t/caseiterable-and-available/37888)

<div class="topic-metadata">

**Author:** [@SlaunchaMan](https://forums.swift.org/u/SlaunchaMan)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 11:35pm UTC](https://forums.swift.org/t/caseiterable-and-available/37888 "2022-03-21T23:35:05Z")

</div>

Consider this enum in Swift: enum Labels: String, CaseIterable { case foo case bar case baz } The CaseIterable conformance is automatically synthesized by the compiler. But if I add a new case with av…

---

## [Conditional availability based on OS version](https://forums.swift.org/t/conditional-availability-based-on-os-version/53467)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 4\
**Last updated:** [November 17, 2021, 2:46am UTC](https://forums.swift.org/t/conditional-availability-based-on-os-version/53467 "2021-11-17T02:46:38Z")

</div>

How do I specify a conditional availability of a type or an extension, etc, so that either my version or the OS version is getting used depending upon OS version? Example pseudo code (doesn't compile): @available (iOS, …

---

## [How do you use deprecation annotations?](https://forums.swift.org/t/how-do-you-use-deprecation-annotations/53279)

<div class="topic-metadata">

**Author:** [@slazarus](https://forums.swift.org/u/slazarus)\
**Replies:** 2\
**Last updated:** [November 4, 2021, 11:43pm UTC](https://forums.swift.org/t/how-do-you-use-deprecation-annotations/53279 "2021-11-04T23:43:23Z")

</div>

Hi everyone! I’ve been thinking about how we can improve on the way deprecation works in Swift. I wanted to reach out to the larger Swift community to get your thoughts on how you use deprecation to help with guiding ide…

---

## [Is there a way to deprecate public APIs for library clients only?](https://forums.swift.org/t/is-there-a-way-to-deprecate-public-apis-for-library-clients-only/52369)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 3\
**Last updated:** [September 27, 2021, 12:29am UTC](https://forums.swift.org/t/is-there-a-way-to-deprecate-public-apis-for-library-clients-only/52369 "2021-09-27T00:29:59Z")

</div>

So, I have a library, which includes a public API for percent-encoding. The library comes with a bunch of "encode sets" (sets of characters which should be percent-encoded) as defined in the URL standard, and it is possi…

---

## [New Xcode modifier conditional compilation](https://forums.swift.org/t/new-xcode-modifier-conditional-compilation/50324)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 2\
**Last updated:** [July 9, 2021, 2:59pm UTC](https://forums.swift.org/t/new-xcode-modifier-conditional-compilation/50324 "2021-07-09T14:59:47Z")

</div>

i'm using this code with the new searchable modifier available with Xcode-13 beta. is there any way to have some conditional compilation check to compile this with Xcode 12? obviously i can't built with it to those newer…

---

## [@available on structure extensions](https://forums.swift.org/t/available-on-structure-extensions/36290)

<div class="topic-metadata">

**Author:** [@bioche](https://forums.swift.org/u/bioche)\
**Replies:** 4\
**Last updated:** [May 8, 2020, 4:36pm UTC](https://forums.swift.org/t/available-on-structure-extensions/36290 "2020-05-08T16:36:06Z")

</div>

Hello all, I have a compilation error that I don't really understand. Perhaps you could enlighten me. I managed to reduce my problem to this small capture Does anyone know why the compiler complains about encode me…

---

## [\`@available\` in computed \`wrappedValue\`](https://forums.swift.org/t/available-in-computed-wrappedvalue/35337)

<div class="topic-metadata">

**Author:** [@marcusrossel](https://forums.swift.org/u/marcusrossel)\
**Replies:** 1\
**Last updated:** [April 13, 2020, 1:02pm UTC](https://forums.swift.org/t/available-in-computed-wrappedvalue/35337 "2020-04-13T13:02:32Z")

</div>

Hey everybody :wave:t2: I was just trying to create a SetOnly property wrapper that would allow for properties that have a setter without an available getter: @propertyWrapper struct SetOnly\<Wrapped\> { private var…

---

## [C interoperability, combinations of library and OS versions](https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029)

<div class="topic-metadata">

**Author:** [@gwendal.roue](https://forums.swift.org/u/gwendal.roue)\
**Replies:** 4\
**Last updated:** [June 27, 2018, 7:07pm UTC](https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029 "2018-06-27T19:07:18Z")

</div>

Hello Swift community, I'm looking for advice. I want to write Swift code that adapts to the various versions of SQLite found in various iOS/macOS versions, as well as it adapts to custom SQLite builds (latest release +…

---

## [How do you properly deprecate a method in a Protocol?](https://forums.swift.org/t/how-do-you-properly-deprecate-a-method-in-a-protocol/13347)

<div class="topic-metadata">

**Author:** [@Arthur](https://forums.swift.org/u/Arthur)\
**Replies:** 7\
**Last updated:** [June 8, 2018, 2:42pm UTC](https://forums.swift.org/t/how-do-you-properly-deprecate-a-method-in-a-protocol/13347 "2018-06-08T14:42:54Z")

</div>

Without using @objc @optional, is there a way to properly deprecate a function in a protocol? I cannot make use of the Objective-C runtime because I tend to have struct types conforming to this protocol. Trivialized exa…
