8

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nonouf
  • 378
  • 2
  • 5
  • 19
  • check JSONModel's readme here:https://github.com/icanzilb/JSONModel it says it's not tested with Swift – Marin Todorov Nov 12 '14 at 22:19
  • 3
    Yes I know but it doesn't mean it's not working. At the moment everything is working. I just would like to override this method to make some tests. – Nonouf Nov 13 '14 at 22:00

1 Answers1

16

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

override class func keyMapper() -> JSONKeyMapper! {
    //code here
}
David Berry
  • 40,941
  • 12
  • 84
  • 95
NobodyNada
  • 7,529
  • 6
  • 44
  • 51