1

I wanted to use the @warn_unused_result @rethrows func filter(@noescape includeElement: (Self.Generator.Element) throws -> Bool) rethrows -> [Self.Generator.Element] method in one of my projects. The App should run on iOS 8 and later. If I look the method up in the documentation it says "Availability: iOS (9.2 and later)"

enter image description here

However, if I call the method on iOS 8.4 it works w/o any issues.

Any ideas why the documentation says iOS 9.2 but it still works on iOS 8.4? So can I call it w/o any availability check and be sure it won't crash in the future?

Thanks in advance!

riik
  • 4,448
  • 1
  • 12
  • 16

1 Answers1

4

This is the part of Swift standard library, it doesn't depend on iOS SDK at all. Swift runtime is bundled with application, so for the system it doesn't matter which version of Swift application was written in. I assume that this availibility mark might have something in common with the change which was made to filter function in Swift 2. Look at those two docs: Swift 2.1 Swift 1.2

As you can see, declarations of those two methods are different.

Community
  • 1
  • 1
Sebastian Osiński
  • 2,894
  • 3
  • 22
  • 34