简体   繁体   中英

Override Objective-C class method in Swift

I'm trying to use JSONModel in a Swift project. I would like to override the method keyMapper from JSONModel but I don't find how to override an Objective-C class method in the model class.

The signature of the method is:

+(JSONKeyMapper*)keyMapper;

How can I do that?

You do it just like you override an instance method, except with the class keyword:

override class func keyMapper() -> JSONKeyMapper! {
    //code here
}

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