You cannot overload the methods that Objective-C can see, since Objective-C has no overload:
func performOperation(operation : (Double,Double) -> Double){ } func performOperation(operation : Double -> Double) { }
(The fact that this was allowed in Swift before Swift 1.2 is actually a bug, Swift 1.2 closed the loophole and fixed the bug.)
A simple solution: hide these methods from Objective-C. For example, declare them as private .
A more complicated solution: change the name with which Objective-C sees one of them. For instance:
func performOperation(operation : (Double,Double) -> Double){ } @objc(performOperation2:) func performOperation(operation : Double -> Double) { }
Or, new in Swift 2.0, you can hide one or both of them from Objective-C without closing it:
@nonobjc func performOperation(operation : (Double,Double) -> Double){ } func performOperation(operation : Double -> Double) { }
source share