JUST POSTED AN UPDATE ABOUT COMPLEX PROJECTS. PLEASE READ THAT TOO!
When you add an Objective-C class to an otherwise-swift project, Xcode invites you to create a bridging header file. This files enables your swift code to access your ObjC classes. I’ve had success with this, but only when I’ve built new ObjC classes from scratch. My complex cross-platform Constraint Pack was too much for it to handle. Here’s what I did to successfully make this work on a trivial case.
- Created a TestClass.[hm] pair.
- Agreed to build a bridging header file
- Built out the test class to a really minimal implementation: one method, – (void) testAction, which logs hello
– (void) testAction
- Added the full headers to the bridging file:
@interface TestClass : NSObject
– (void) testAction;
- Tested the class from my swift source
let foo : TestClass = TestClass()
And everything works as promised. But for very small values of “combining objc/swift”…