简体   繁体   中英

Can I include a single ObjC class when compiling Swift code?

In my understanding, it will be possible to work with Obj-C classes from Swift and write test cases much more quickly, and see the results in a playground project.

Does *.playground support including just a single class, like an .m/.h pair? How does it work? Do I need to compile this class separately, or is it done automatically?

Unfortunately, a pure playground allows to import only Cocoa framework (for now, at least).

If you want to import other modules, you need to create a playground file inside an existing project . That way, the underlying Swift code inside the playground can access your symbols.

Reference: Does swift playground support UIKit?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM