Search code examples
iosswiftsnapkitswift5xcode10.2

Warning : Unexpected version number in 'available' attribute for non-specific platform '*'


I have this snippet code :

@available(*, deprecated:3.0, message:"Use activate().")
public func install() {
    self.activate()
}

And since i've upgraded to swift5 and xcode 10.2 i get below warning :

Unexpected version number in 'available' attribute for non-specific platform '*'

And fixed with :

Replace ':3.0' with ''

What is this warning? what does it say?


Solution

  • The documentation states that the asterisk cannot be used with Swift version numbers, but perhaps this wasn't enforced before Swift 5?

    The equivalent attribute would be:

    @available(swift, deprecated:3.0, message:"Use activate().")
    

    Even better would be:

    @available(swift, deprecated:3.0, renamed:"activate()")