Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 624
Mohsen Sedaghat Fard Avatar asked Apr 17 '19 06:04

Mohsen Sedaghat Fard


1 Answers

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()")
like image 135
Dave Weston Avatar answered Oct 28 '22 09:10

Dave Weston