- Add (auto-generated) bridging header
ProductName-Bridging-Header.h. - Add
SWIFT_VERSIONtoBuild Settings -> Swift Compiler - Language. - Fix
Multiple commands produce '.../Objects-normal/x86_64/ProductName.swiftmodule'- target ProductNames should differ. - Set "Defines Modules" to "Yes" in
Build Settings -> Packaging. #import "Objective-C Generated Interface Header Name"- Remove
#import "ProductName-Swift.h"from headers to implementation, add forward declaration to headers.
I had such constructor in MyClass:
public override init(userDefaults: UserDefaults) {
And I wanted to call it in Objc like this:
MyClass* obj = [[MyClass alloc] initWithUserDefaults:NSUserDefaults.standardUserDefaults];
It didn't work, while this did:
@objc convenience init(userDefaults: UserDefaults)
More comments about optional value type bridging/optional reference type bridging is here