<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">In the <a href="https://swift.org/migration-guide/">official migrating guide</a>.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default"><p style="font-family:&#39;helvetica neue&#39;,helvetica,arial,verdana,sans-serif;box-sizing:border-box;margin:0px 0px 1.5em;padding:0px;color:rgb(51,51,51);font-size:18px">You can choose from two kinds of migration to perform:</p><ul style="font-family:&#39;helvetica neue&#39;,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"><li style="box-sizing:border-box;margin:0px;padding:0px"><strong style="box-sizing:border-box">Use Swift 2.3</strong> Modifies your project to enable the <em style="box-sizing:border-box">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"><strong style="box-sizing:border-box">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:&#39;helvetica neue&#39;,helvetica,arial,verdana,sans-serif;box-sizing:border-box;margin:0px 0px 1.5em;padding:0px;color:rgb(51,51,51);font-size:18px">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"><font color="#000000" face="georgia, serif">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"><font color="#000000" face="georgia, serif"><a href="https://developer.apple.com/reference/foundation/data/1780388-init">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>Swift<br>SDKs<br>iOS 10.0+<br>macOS 10.12+<br>tvOS 10.0+<br>watchOS 3.0+</blockquote><div> </div><div><font color="#000000" face="georgia, serif">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&#39;s swift version is default 3.0. I thought I couldn&#39;t use any apis that were marked as `macOS 10.12+`. However, I was wrong. Below code worked.</font></div><div><font color="#000000" face="georgia, serif"><br></font></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(187,44,162)">var</span><span style="font-variant-ligatures:no-common-ligatures"> data = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)">Data</span><span style="font-variant-ligatures:no-common-ligatures">(base64Encoded: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)">&quot;Hello World!&quot;</span><span style="font-variant-ligatures:no-common-ligatures">)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(61,29,129)">print</span><span style="font-variant-ligatures:no-common-ligatures">(data) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,132,0)">// prints nil</span></p></div><div><font color="#000000" face="georgia, serif"><br></font></div><div><font color="#000000" face="georgia, serif">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&#39;t use it in old OS. Is that rule changed in Swift 3?</font></div><div><font color="#000000" face="georgia, serif"><br></font></div><div><font color="#000000" face="georgia, serif">Zhaoxin</font></div><div><font color="#000000" face="georgia, serif"><br></font></div><div><font color="#000000" face="georgia, serif"><br></font></div></div></div>