-1

My understanding of the #available syntax was that it was specifying the major / minor versions of iOS. However, I am noticing that code protected by this if clause will be executed on iOS 12.

Is it expected that #available resolves to a >= check?

It appears to do this whether it has been compiled by the current version of Xcode (targeting iOS 11) as well as the beta version targeting iOS

MobileVet
  • 2,958
  • 2
  • 26
  • 42
  • 2
    Is it expected that #available resolves to a >= check? - Yes it will check the from available to current https://www.raywenderlich.com/139077/availability-attributes-swift – Chirag Shah Jul 24 '18 at 13:51
  • 1
    that is how it supposed to work. – holex Jul 24 '18 at 13:57
  • Cool, thanks for the clarification and the link. I tried to find the Apple documentation for it and couldn't... – MobileVet Jul 24 '18 at 14:01
  • 2
    Why do you downvote a valid question? Just post the answer and or a link showing the answer in some kind of official documentation. Honestly, people won't post questions if we treat them like fools for doing so. – MobileVet Jul 24 '18 at 14:02

1 Answers1

5

Yes, that is expected. #available is meant to be used to enclose functions that have been added in specific iOS version, that are available since that version forward.

mag_zbc
  • 6,801
  • 14
  • 40
  • 62