The “*” in @available means “all other platforms”. If you want to mark 
something unavailable on a particular platform, you’ll have to use the long 
form of the @available attribute. There’s currently no way to mark something 
“only available on these platforms”.

Jordan

> On May 25, 2016, at 18:48, Stuart Breckenridge via swift-evolution 
> <[email protected]> wrote:
> 
> Presently, you can mark enum cases as @available but it has no impact. Take 
> the following example:
> 
> enum Things:String {
>       @available (iOS 9.3, *) case MobileThing = "com.example.mobilething"
>       @available (OSX 10.11, *) case DesktopThing = "com.example.desktopthing"
> }
> 
> Despite the above compiling, the following code will run iOS with no warnings:
> 
> func takesA(thing:Things) {
>       print(thing)
> }
> 
> takesA(.DesktopThing)
> 
> 
> Are there enough compelling use-cases for @available on enum cases to be 
> considered? At the very least, if @available doesn't do anything on cases, it 
> shouldn't be permitted.
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to