<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Oops, I didn't notice that my own deployment target was already set to iOS 11. I see what you're seeing now. Can you file a bug for this at <a href="https://bugs.swift.org" class="">https://bugs.swift.org</a>&nbsp;?</div><div class=""><br class=""></div><div class="">Workaround: put the override in an extension, and put the availability on the extension declaration. That seems to work for me.</div><div class=""><br class=""></div><div class="">Sorry for the trouble!</div><div class="">Jordan</div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 2, 2017, at 14:12, Rod Brown &lt;<a href="mailto:rodney.brown6@icloud.com" class="">rodney.brown6@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Jordan,</div><div class=""><br class=""></div><div class="">So sorry, my snippet really wasn’t helpful there! Gah. &nbsp;I realise the extension wasn’t right! Sorry *facepalm*.</div><div class=""><br class=""></div><div class="">So I have a project. Its deployment target is iOS 10 (because we need 10.0 compatibility for the foreseeable future).</div><div class=""><br class=""></div><div class="">If I add the following code I get errors when it builds:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">class</span> MyViewControllerSubclass: <span style="color: #703daa" class="">UIViewController</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">@available</span>(<span style="color: #ba2da2" class="">iOS</span>, introduced: 11.0)</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">override</span> <span style="color: #ba2da2" class="">var</span> additionalSafeAreaInsets: <span style="color: #703daa" class="">UIEdgeInsets</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ba2da2" class="">didSet</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Need to do work here<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span id="cid:1FA8EEC3-D77C-4FA1-97A7-FE1FCEC3752A">&lt;Screen Shot 2017-08-03 at 7.08.24 am.png&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div class="">My only solution at this stage is currently to KVO on the AdditionalSafeAreaInsets property, which works, but this seems to point out a language deficiency.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 3 Aug 2017, at 3:24 am, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">I'm not sure why you're using 'override' in an extension. Did you mean to put that in a subclass? It seems to work for me there.</div><div class=""><br class=""></div><div class="">Yes, Swift will not let you replace existing methods/properties using an extension if it can statically see that the method/property already exists. (It's not even safe to do that in Objective-C, but the language doesn't stop you.)</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Aug 1, 2017, at 22:46, Rod Brown via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Looks like this is a duplicate of this issue:</div><div class=""><br class=""></div><div class=""><a href="https://bugs.swift.org/browse/SR-1486" class="">https://bugs.swift.org/browse/SR-1486</a></div><div class=""><br class=""></div><div class="">I’m curious if anyone knows whether that is actually a bug, or a behavioural choice on Swift’s part?</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2 Aug 2017, at 10:31 am, Rod Brown via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi everyone,<div class=""><br class=""></div><div class="">Something I’ve come across in iOS 11 is that you can’t override properties that are only available on iOS 11 when deploying with a deployment target less than the current target.</div><div class=""><br class=""></div><div class="">For example the following code is invalid:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; color: rgb(112, 61, 170); background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(186, 45, 162);" class="">extension</span><span style="" class="">&nbsp;</span>UIViewController<span style="" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">@available</span>(<span style="color: rgb(186, 45, 162);" class="">iOS</span>, introduced:&nbsp;<span style="color: rgb(39, 42, 216);" class="">11.0</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">open</span>&nbsp;<span style="color: rgb(186, 45, 162);" class="">override</span>&nbsp;<span style="color: rgb(186, 45, 162);" class="">var</span>&nbsp;<span style="text-decoration: underline;" class="">a</span>dditionalSafeAreaInsets:&nbsp;<span style="color: rgb(112, 61, 170);" class="">UIEdgeInsets</span>&nbsp;{</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">didSet</span>&nbsp;{</div><div style="margin: 0px; font-size: 11px; line-height: normal; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>// Do work here only relevant to iOS 11</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">&nbsp; &nbsp; } &nbsp;&nbsp;</div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">}</div></div><div class=""><br class=""></div><div class="">This would be easily overridden in Obj-C, but I can’t do it in Swift. Is there any reason why this limitation exists?</div></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Rod</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=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>