<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The API Reference SDK availability section in the documentation is incorrect for symbols defined in a Swift overlay. This is a known issue.<div class=""><br class=""></div><div class="">Unless it has an explicit @available attribute (check the generated interface), any symbol defined in a Swift overlay is available for all platform versions where swift 3 is compatible (iOS 7, macOS 10.9, etc).</div><div class=""><div class=""><br class=""></div><div class="">Jack<br class=""><div><blockquote type="cite" class=""><div class="">On Sep 25, 2016, at 6:01 PM, Zhao Xin via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">In the <a href="https://swift.org/migration-guide/" class="">official migrating guide</a>.</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default"><p style="font-family:'helvetica neue',helvetica,arial,verdana,sans-serif;box-sizing:border-box;margin:0px 0px 1.5em;padding:0px;color:rgb(51,51,51);font-size:18px" class="">You can choose from two kinds of migration to perform:</p><ul style="font-family:'helvetica neue',helvetica,arial,verdana,sans-serif;box-sizing:border-box;margin:1em 0px;padding:0px 0px 0px 40px;list-style-position:initial;color:rgb(51,51,51);font-size:18px" class=""><li style="box-sizing:border-box;margin:0px;padding:0px" class=""><strong style="box-sizing:border-box" class="">Use Swift 2.3</strong> Modifies your project to enable the <em style="box-sizing:border-box" class="">Use Legacy Swift</em> build setting and provides source changes to be able to build against the new SDKs.</li><li style="box-sizing:border-box;margin:0px;padding:0px" class=""><strong style="box-sizing:border-box" class="">Use Swift 3</strong> This is recommended. You will get source changes to be able to build your project using Swift 3 and take advantage of all the new features in Xcode 8.0.</li></ul><p style="font-family:'helvetica neue',helvetica,arial,verdana,sans-serif;box-sizing:border-box;margin:0px 0px 1.5em;padding:0px;color:rgb(51,51,51);font-size:18px" class="">Optionally, you can move to Swift 2.3 now and invoke the migration assistant again later to update to Swift 3.</p><p style="box-sizing:border-box;margin:0px 0px 1.5em;padding:0px" class=""><font face="georgia, serif" class="">So it seems to me that Swift 3 will only works with the new SDKs (iOS 10, macOS 10.12, watchOS 3, tvOS 10). The API explanation enhanced my theory.</font></p><p style="box-sizing:border-box;margin:0px 0px 1.5em;padding:0px" class=""><font face="georgia, serif" class=""><a href="https://developer.apple.com/reference/foundation/data/1780388-init" class="">Data.init(base64Encoded:options:)</a></font></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Language<br class="">Swift<br class="">SDKs<br class="">iOS 10.0+<br class="">macOS 10.12+<br class="">tvOS 10.0+<br class="">watchOS 3.0+</blockquote><div class=""> </div><div class=""><font face="georgia, serif" class="">I created a new Cocoa application project in Xcode 8. Since my OS is macOS 10.11, the `Deployment Target` is `10.11`, the `Base SDK` is `10.12`. Since the newly created project's swift version is default 3.0. I thought I couldn't use any apis that were marked as `macOS 10.12+`. However, I was wrong. Below code worked.</font></div><div class=""><font face="georgia, serif" class=""><br class=""></font></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(187,44,162)" class="">var</span><span style="font-variant-ligatures:no-common-ligatures" class=""> data = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">Data</span><span style="font-variant-ligatures:no-common-ligatures" class="">(base64Encoded: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)" class="">"Hello World!"</span><span style="font-variant-ligatures:no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(61,29,129)" class="">print</span><span style="font-variant-ligatures:no-common-ligatures" class="">(data) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,132,0)" class="">// prints nil</span></div></div><div class=""><font face="georgia, serif" class=""><br class=""></font></div><div class=""><font face="georgia, serif" class="">So what are the boundary between old APIs with new APIs between OS versions? Is the API doc wrong? In previous docs, if an API is marked as available only in the latest OS, you can't use it in old OS. Is that rule changed in Swift 3?</font></div><div class=""><font face="georgia, serif" class=""><br class=""></font></div><div class=""><font face="georgia, serif" class="">Zhaoxin</font></div><div class=""><font face="georgia, serif" class=""><br class=""></font></div><div class=""><font face="georgia, serif" class=""><br class=""></font></div></div></div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></div></body></html>