[swift-users] Can't access Swift class from Objective-C

Jordan Rose jordan_rose at apple.com
Tue Apr 18 12:45:25 CDT 2017

Hey, Rick. I think we'd need a bit more information to really diagnose this—in particular, the class declaration in Swift—but here are some possibilities:

- Classes that don't inherit from NSObject are not exposed to Objective-C
- Classes with any generic ancesters are not exposed to Objective-C, even if they themselves are not generic. (There's an implementation reason for this; it's not just the compiler being capricious.)
- In frameworks, only public and open classes are included in the generated header, since it's part of your framework's public interface.

Are you in any of these situations?


> On Apr 17, 2017, at 20:18, Rick Mann via swift-users <swift-users at swift.org> wrote:
> My Objective-C file is importing "Module-Swift.h", and that file has some of my other Swift classes, but not the one I just wrote. I've tried making the class public, but I didn't need to do that on any of the others.
> I've tried cleaning the build folder of my Xcode project, but I get the same result.
> Any suggestions? Thanks!
> -- 
> Rick Mann
> rmann at latencyzero.com
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170418/631f7612/attachment.html>

More information about the swift-users mailing list