7

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?

  • 2
    I actually experienced the same thing when I was migrating to Swift 5. But such kind of warning went away after completely updating what needs to be updated, clean, and build. – Glenn Posadas Apr 17 '19 at 06:43

1 Answers1

10

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()")
Dave Weston
  • 6,042
  • 1
  • 22
  • 38
  • In my case, this is inside a 3rd party library, and I cannot update the source code for this library as it is no longer maintained.. Is there a workaround where by such enforcement that * cannot be used, can be given an exception? – Skywalker Jan 20 '21 at 07:28