Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need clarity on difference between swift 3 compatibility and API availability

Tags:

ios

ios10

swift

Some examples: In swift 2 we had NSData and NSUrl; in swift 3 we have Data and URL. If you alt click on Data it says available from iOS 10 and above.

Please can someone explain the following: if the Apple docs say something is only available from iOS 10 and above, does that mean I can only use it on an app that's target is iOS 10 and above?

I have read that Swift 3 is compatible with iOS 8, but these changes (NSData to Data, for example) were part of the move from Swift 2 to 3. So if Data is only available in iOS 10 and above, what does it mean to say Swift 3 is compatible with iOS 8?

I guess, in essence, I am confused about the difference between API availability and Swift 3 compatibility.

Your help is much appreciated.

like image 306
thecloud_of_unknowing Avatar asked Feb 04 '17 07:02

thecloud_of_unknowing


1 Answers

if the Apple docs say something is only available from iOS 10 and above, does that mean I can only use it on an app that's target is iOS 10 and above?

No. The availability part of Apple's docs may show two different kinds of info -- the SDK availability and the target OS availability.

In the case of Data, the Standard Library code of Data is compatible for all iOS's 8 and later, but the Standard Library including Data (Swift 3 Standard Library) is included only in iOS SDK 10 or later, the availability part of the Apple's doc is representing the "availability" in that meaning.

This thread in the Apple's dev forums would be some help. Generally, you can rely on the availability checking feature of Xcode/Swift. When you marked your project's minimum target to iOS 8.0 and you get no warnings about availability, all the features used in the project should work on iOS 8.0 devices.

You can send a bug report about this as a documentation error.

like image 109
OOPer Avatar answered Nov 06 '22 22:11

OOPer