As we know, the Swift
language allows Function Overloading, in Objective-c
the overloading is not legal.
So I test in my demo project:
import UIKit
class FuncOverLoad: NSObject {
func helloFuc (_ what:String) {
}
func helloFuc (_ what:Int) {
}
func helloFuc() -> String {
return "one"
}
func helloFuc() -> Int {
return 1
}
}
But, why there comes the error:
Method ‘helloFuc’ with Objective-C selector ‘helloFunc:’ conflicts with previous declaration with the same Objective-C selector
I take the picture:
Why comes the issue, if Swift
function overloading is legal?