I get following error:
Throwing method cannot be a member of an @objc protocol because it returns a value of type 'Bool'; return 'Void' or a type that bridges to an Objective-C class
When defining Swift protocol which also needs to be bridged to Objective-C:
@objc public protocol Saving {
func save() throws -> Bool
}
Is there an other way to define Swift method which can return Bool
, potentially throw an error and be Objetive-C
compatible?
func save() throws
would be translated to Objective-C as- (BOOL)saveAndReturnError:(NSError **)error;
– Libration