<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="" applecontenteditable="true"><div class="">Hi, Pavel. This is definitely supported, and it is indeed a bug that these are not both producing 'true'. We're tracking this as <a href="rdar://problem/24453316" class="">rdar://problem/24453316</a>.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 5, 2017, at 03:14, Pavel Ivashkov 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=""><span style="font-size:12.8px" class="">Hello,</span><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">What is the current view on inheriting non-objc protocol from objc protocol? Is it supported? Is it a valid construct?<br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">import Foundation</div><div class=""><br class=""></div><div class="">@objc protocol Base {}<br class=""></div><div class=""><br class=""></div><div class="">protocol Some : Base {}<br class=""></div><div class=""><br class=""></div><div class="">class Nada : NSObject, Some {}<br class=""></div><div class=""><br class=""></div><div class="">let x: NSObject = Nada()<br class=""></div><div class=""><br class=""></div><div class="">print("Nada is Some? \(x is Some)")<br class=""></div><div class="">print("Nada is Base? \(x is Base)")</div></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div style="font-size:12.8px" class="">There are two statements in the docs on @objc attribute:</div><div style="font-size:12.8px" class="">a) The compiler also implicitly adds the objc attribute to a class that inherits from another class marked with the objc attribute or a class defined in Objective-C.</div><div style="font-size:12.8px" class="">b) Protocols marked with the objc attribute can’t inherit from protocols that aren’t.<br class=""></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">But they don't spec the other way round about protocols.</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Currently the output is</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class=""><div class="">swift main.swift</div><div class="">Nada is Some? true</div><div class="">Nada is Base? false</div></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Which is not what I would expect.</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Here is extended example: <a href="http://stackoverflow.com/q/42023977" target="_blank" class="">http://stackoverflow.<wbr class="">com/q/42023977</a></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class=""><div class="">swift --version</div><div class="">Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)</div><div class="">Target: x86_64-apple-macosx10.9</div></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">(same on 3.1-dev)</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=""></body></html>