[swift-users] unsafeBitCast to Unimplemented Class

Andrew Trick atrick at apple.com
Tue Feb 7 00:57:35 CST 2017

> On Feb 6, 2017, at 8:51 PM, Dave Abrahams <dabrahams at apple.com> wrote:
> on Mon Feb 06 2017, Andrew Trick <atrick-AT-apple.com> wrote:
>> Is a missing declaration a use case that needs to be supported?
> I couldn't say.
>> Wouldn’t it be more proper to use selector based dispatch in those
>> cases?
> Example, please?  I don't know what that means, though I probably should.
> -- 
> -Dave

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:

if ([self isKindOfClass:NSClassFromString(@“Bar”)]) {

It's not type safe, but it's a lot better than outright lying about the reference's dynamic type.

Of course, the root problem is that Bar's declaration is unavailable, and that's not a normal, expected thing.


More information about the swift-users mailing list