<div dir="ltr">+1 to this. It's really important for getting a sane third-party library ecosystem working.<div><br></div><div>I assume that the @available annotation generated would also work for watchOS, tvOS, etc. frameworks. How would it work for non-iOS Swift platforms? I'm not terribly familiar with how #available works on Linux, but the versioning problem exists there too.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 4, 2016 at 4:48 PM, Drew Crawford via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Suppose *<b>Apple*</b> ships a framework that is only supported in iOS 9.3. As a direct consequence, the framework is only #available in iOS 9.3 or later.</div><div><br></div><div>Suppose Jane links this framework into her iOS application. The deployment target for her application *can be any value*. She sets the framework to be weakly linked, and as long as the code that uses the Apple framework is guarded by a 9.3 availability check, she can deploy back to 8.0, 7.0, etc.</div><div><br></div><div>Suppose *I* ship a custom framework that I only want to bother supporting for iOS 9.3 users. I'm not testing on old OS, I don't have CI on old OS, and quite frankly I have no idea if it works. And I'm not in the habit of shipping code that wasn't even tested on my machine. As a direct consequence, I set my framework deployment target to 9.3.</div><div><br></div><div>Now Jane links this framework into her "deployment target 8.0" application. She weakly links it and uses availability checks just like she did with the Apple framework. But this time the compiler says no:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>error: module file's minimum deployment target is ios9.3 v9.3</div></blockquote><div><br></div>Jane now has a set of bad choices:<div><br></div><div>1. She can not use my framework at all</div><div>2. She can drop support for <9.3 entirely from her application in order to use my framework</div><div>3. She can convince me to support iOS 8, when I don't want to invest in the QA and test time.</div><div>4. She can convince me to set my deployment target to 8, try to find all my public APIs, sprinkle `@available(iOS 9.3, *)` everywhere and hope I didn't miss any. Spoiler alert: that's what I did all afternoon.</div><div><br></div><div>This is too hard. IMO Jane should be able to use my "9.3+" frameworks as easily as she can use Apple's.</div><div><br></div><div>IMO, when Jane imports a "DT 9.3" framework, into her "DT 8.0" application, it should A) import successfully, B) link weakly, and C) have `@availability(9.3, *)` overlayed on the interface.</div><div><br></div><div>There may be some subtle additional details because I don't know exactly the implementation of these features, but that's the general idea.</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>