You cannot overload methods that Objective-C can see, because Objective-C has no overloading:
func performOperation(operation : (Double,Double) -> Double){
}
func performOperation(operation : Double -> Double) {
}
(The fact that this was allowed in Swift before Swift 1.2 was in fact a bug; Swift 1.2 closed the loophole and fixed the bug.)
Simple solution: hide these methods from Objective-C. For example, declare them both private
.
More tricky solution: change the name by which Objective-C sees one of them. For example:
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 going so far as to make it private:
@nonobjc func performOperation(operation : (Double,Double) -> Double){
}
func performOperation(operation : Double -> Double) {
}