<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I’m not sure about this, as restricting anything by OS generally makes me uneasy; where possible we should always try to restrict code by availability and version of modules, as these will indicate the actual features that a platform should support. Part of the problem is that we can’t guarantee what new OSes will be supported in future, in your example you’ve already only covered Apple OSes, but Linux support is on its way, and Windows support may come (Visual Studio may already support it).</div><div class=""><br class=""></div><div class="">I mean, it’s no more or less prone to issues than @available I suppose, but I’m not a fan of limiting features and support in this way to begin with.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 26 May 2016, at 14:25, Stuart Breckenridge via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><h1 id="addanrestricteddeclarationattribute" style="text-align: left; box-sizing: border-box; font-size: calc(1.2777777777777777rem); margin: 0px 0px calc(3.3333333333333335rem); line-height: calc(1.3043478260869565); text-transform: uppercase; letter-spacing: 0.5px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">ADD AN @RESTRICTED DECLARATION ATTRIBUTE</h1><ul style="box-sizing: border-box; padding-left: 1.5rem; margin: calc(1.6666666666666667rem) auto 0px; list-style: none; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><li style="box-sizing: border-box;" class="">Proposal: SE-NNNN</li><li style="box-sizing: border-box;" class="">Author: Stuart Breckenridge</li><li style="box-sizing: border-box;" class="">Status: DRAFT</li><li style="box-sizing: border-box;" class="">Review Manager: TBD</li></ul><h2 id="introduction" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Introduction</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Adapted from the Swift 2.2 Programming Guide:</div><blockquote style="box-sizing: border-box; margin: calc(1.6666666666666667rem) calc(-0.8888888888888888rem) 0px; padding-left: calc(2.2222222222222223rem); padding-right: calc(2.2222222222222223rem); font-style: italic; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px;" class="">The&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;attribute indicates a declaration’s life cycle relative to certain platforms and operating systems. Today’s functionality allows you to add multiple&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;attributes on a declaration to specify its availability on different platforms.</div></blockquote><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">In a related Swift Evolution discussion examining the&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;attribute, it was confirmed that there is currently no way to limit availability to specific platform without using the long form approach.</div><h2 id="motivation" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Motivation</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">When a declaration is only available on a certain platform, it requires multiple&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;attributes to restrict its availability to that platform. Consider the following example using&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">SLServiceType</code>&nbsp;like constants:</div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">@available(iOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
@available(OSX 10.8, *)
case LinkedIn = "com.apple.social.linkedin"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">The compiler will only use an&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;attribute when the attribute specifies a platform that matches the current target platform. The implication being that if the target platform isn’t specified, then the attribute defaults to available.</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Thus, while it is clear that the above is restricting availability to OS X 10.8 and later, it is verbose and&nbsp;<span style="box-sizing: border-box; font-weight: 600;" class="">can be simplified</span>.</div><h2 id="proposal" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Proposal</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Implement an&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;attribute which is the inverse of&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>. The effect would be that the compiler would use&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;to limit the declaration to be available on the platform(s) specified in the attribute. Similar to&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>, multiple&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;attributes can be added to a declaration.&nbsp;</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Therefore, where&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;attribute(s) are present and target platform&nbsp;<em style="box-sizing: border-box;" class="">is not</em>&nbsp;specified, the declaration is not available on the unspecified target platform. In addition, where a&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;attribute has been applied to a declaration, it should not be commingled with&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;on the same declaration (it would lead to intense confusion).</div><h2 id="design" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Design</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">From a syntax perspective, it would follow&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>:</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">@restricted(<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">platform name</code>&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">version number</code>, *)</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">or</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">@restricted(<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">platform name</code>,&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">introduced=version number</code>)</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Similarly, all&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;arguments would be available to&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>.&nbsp;</div><h3 id="examples" style="text-align: left; box-sizing: border-box; margin-top: calc(1.6666666666666667rem); font-size: 1rem; margin-bottom: 0px; line-height: calc(1.6666666666666667); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Examples</h3><div class=""><br class=""></div><div style="box-sizing: border-box; margin: 0px auto; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Using the previous example, instead of using&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>&nbsp;to specify unavailability, we use&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;to scope the declarations availability:</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><em style="box-sizing: border-box;" class="">Single Platform Restriction</em></div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">@restricted(OSX 10.8, *)
case LinkedIn = "com.apple.social.linkedin"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Effect: only available on OS X 10.8 or newer.</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><em style="box-sizing: border-box;" class="">Multiple Platform Restriction</em></div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">@restricted(OSX 10.8, iOS 9.4, *)
case LinkedIn = "com.apple.social.linkedin"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Effect: Available on OSX 10.8 or newer, and iOS 9.4 or newer.</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><em style="box-sizing: border-box;" class="">Restricted within Version Bounds</em></div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">@restricted(OSX, introduced=10.8, deprecated=10.10, obsoleted=10.11, message="No longer available.")
case LinkedIn = "com.apple.social.linkedin"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Effect: Available on OS X from 10.8 through 10.11 only.</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><em style="box-sizing: border-box;" class="">Restricted with Renamed Case</em></div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">// Initial Release
@restricted(OSX 10.10, *)
case TencentWeibo = "com.apple.social.tencentweibo"

// Second Release
@restricted(OSX, introduced=10.10, deprecated=10.11, renamed="Weibo")
case TencentWeibo = "com.apple.social.tencentweibo"

@restricted(OSX 10.11) case Weibo = "com.apple.social.weibo"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Effect: Initial release case is restricted to 10.10 and newer; second release has the original case deprecated from 10.11, with a new case introduced which is available on OS X 10.11 and newer only.&nbsp;</div><h2 id="benefitsimpactonexistingcode" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Benefits &amp; Impact on existing code</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;has the benefit of reducing the amount code while maintaining clarity of purpose: it is obvious based on the attribute name what the intent is.&nbsp;</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>&nbsp;is purely additive, and therefore has no impact on existing code that makes use of&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>.&nbsp;</div><h2 id="alternatives" style="text-align: left; box-sizing: border-box; margin-top: calc(3.3333333333333335rem); margin-bottom: calc(1.6666666666666667rem); font-size: calc(1.1666666666666667rem); line-height: calc(1.4285714285714286); color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif;" class="">Alternatives</h2><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">An alternative, though not a strict replacement of&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>, could be to extract the&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">unavailable</code>argument and use it as an attribute (<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@unavailable</code>). In use:</div><pre style="box-sizing: border-box; overflow: hidden; font-family: monospace, monospace; font-size: 14px; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 1rem; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26);" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; padding: 0px;" class="">@available(OSX 10.8, *)
@unavailable(iOS, *)
case LinkedIn = "com.apple.social.linkedin"
</code></pre><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">Effect: Available on OS X but not iOS.</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class=""><code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@unavailable</code>&nbsp;is worthy of further discussion as using an&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">unavailable</code>&nbsp;argument inside an&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@available</code>attribute seems counterintuitive.&nbsp;</div><div style="box-sizing: border-box; margin: calc(1.6666666666666667rem) auto 0px; color: rgb(26, 26, 26); font-family: NittiGrotesk, Keyboard, sans-serif; font-size: 14px;" class="">However, this proposal is limited to the consideration of&nbsp;<code style="box-sizing: border-box; font-family: NittiPro, Keyboard, monospace; font-size: calc(0.8333333333333334em); border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; white-space: pre-wrap; background-color: rgb(230, 230, 230); padding: 0.1667em 0.3334em 0.25em;" class="">@restricted</code>.</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>