I skimmed through the section on the available
attribute on The Swift Programming Language: Redirect but didn't find a mention of exactly which declarations they can be applied to. I was looking for stored properties in particular but couldn't find a mention of properties at all.
Where should I look for this info?
Background
I can apply available
to a static var
in a class, and it compiles. Then I read this, allegedly from the Xcode 14 release notes:
Stored properties in Swift can’t have type information that is potentially unavailable at runtime. However, prior to Swift 5.7 the compiler incorrectly accepted @available attributes on stored properties when the property had either the lazy modifier or an attached property wrapper. This could lead to crashes for apps running on older operating systems. The Swift compiler now consistently rejects @available on all stored properties.
I'm not using lazy modifiers or property wrappers (Xcode 13.3) so shouldn't my use be rejected? Or is it technically incorrect to call static
class variables "properties" (the docs say "You define type properties with the static
keyword", so I assume not) or "stored" (the docs say "Stored type properties can be variables or constants", so I assume not)?