<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=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Saagar Jha</div>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Feb 6, 2017, at 10:57 PM, Andrew Trick &lt;<a href="mailto:atrick@apple.com" class="">atrick@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Feb 6, 2017, at 8:51 PM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:<br class=""><br class=""><br class="">on Mon Feb 06 2017, Andrew Trick &lt;<a href="http://atrick-AT-apple.com" class="">atrick-AT-apple.com</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class="">Is a missing declaration a use case that needs to be supported?<br class=""></blockquote><br class="">I couldn't say.<br class=""><br class=""><blockquote type="cite" class="">Wouldn’t it be more proper to use selector based dispatch in those<br class="">cases?<br class=""></blockquote><br class="">Example, please? &nbsp;I don't know what that means, though I probably should.<br class=""><br class="">-- <br class="">-Dave<br class=""></blockquote><br class="">I phrased that as a question because I'm the last person who should be giving advice here... What I had in mind is this:<br class=""><br class="">if ([self isKindOfClass:NSClassFromString(@“Bar”)]) {<br class=""> &nbsp;self.perform(@selector(FakeBarProtocol.foo))<br class="">}<br class=""><br class="">It's not type safe, but it's a lot better than outright lying about the reference's dynamic type.<br class=""><br class="">Of course, the root problem is that Bar's declaration is unavailable, and that's not a normal, expected thing.<br class=""></div></div></blockquote><div><br class=""></div><div>Yep, it’s not–that’s why I need to go through this trouble :) My plugin is loaded at runtime, so the headers are the best I’ve got (though if you’ve got a way to perform a stricter check, I’m all ears!) Until then, all of these methods appear to be sugarcoating around perform(selector:)–is there any “preferred” way to do this?</div><div><br class=""></div><div>Also, class_getName(_:) seems to return a UnsafePointer&lt;Int8&gt;, is this just a C-style string? Should I use this over NSStringFromClass or isKindOfClass?</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">-Andy<br class=""><br class=""></div></div></blockquote></div><br class=""></body></html>