Swift 3 new String methods tagged iOS10+ but work in iOS8+

Hello,


When migrating to Swift 3 I had to update the way I deal with string parsing and used new method like

https://developer.apple.com/reference/swift/string/1643093-replacingcharacters


This method is tagged as iOS10+ in the documentation but works well on iOS9 (tested on device) and iOS8 (tested on Simulator)


Is there something I missing here ? Is it an error in the documentation (the swift library is perhaps embedded in the app and not in iOS???)


Thanks for your highlights!

Replies

You can find SDKs just before iOS 10+ in the linked article, which means the method is available in Swift 3 which comes with iOS 10 SDK.

So, it's a sort of an error in the documentation and you better rely on the availability checking feature of Swift & Xcode.

If you set the Deployment Target to iOS 8.0 and Swift does not show any warnings or errors about availability, then the app should work on all iOS8+ devices.

As far as I tested on the actual devices (sorry, not many) no exception.

To expand on OOPer’s answer:

Is it an error in the documentation …

Yes.

… the swift library is perhaps embedded in the app and not in iOS

Correct. Right now the Swift standard library (and various other core Swift libraries, most notably Foundation) are embedded within your app, so you can use them on older platforms. This is new territory for Apple and our doc infrastructure is a little behind.

Please file a bug against the docs requesting that they deal with this better, then post your bug number here, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"