I am trying to override this objective-c method in a swift subclass. I keep getting compiler errors though:
From AWSMTLModel
- (instancetype)initWithDictionary:(NSDictionary *)dictionary error:(NSError **)error
Swift subclass
override func init!(dictionary dictionaryValue: [NSObject : AnyObject]!)//error: overriding declaration requires override keyword (fix it places override after func but gives same error
Drop the func.
override init?(withDictionary dict: [NSObject : AnyObject])
Also, I would get rid of the implicitly unwrapped optionals. If the init can fail, make it an optional. If the dictionary parameter is optional, create another convenience init that takes no parameters, but which creates a default dictionary and calls this init.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With