1

I've got a Swift function that has a default parameter.

class Derp: NSObject{
    @objc(derp:derpsalot:)
    func derp(derpington: Int, derpsalot: Double = 0.0){

    }
}

Is there any way to have this imported into Objective-C as two methods? I'd like to be able to call the function in Objective-C with or without the default parameter.

[myDerp derp:123];
[myDerp derp:123 derpsalot:456.789];

Is this possible? or do I have to write two separate functions in Swift?

rmaddy
  • 307,833
  • 40
  • 508
  • 550
dave234
  • 4,635
  • 1
  • 13
  • 28

0 Answers0