Wie wir wissen, ermöglicht die Sprache Funktion Überladung, in Objective-c
die Überladung ist nicht zulässig.Swift Overloading Problem
So teste ich in meinem Demo-Projekt:
import UIKit
class FuncOverLoad: NSObject {
func helloFuc (_ what:String) {
}
func helloFuc (_ what:Int) {
}
func helloFuc() -> String {
return "one"
}
func helloFuc() -> Int {
return 1
}
}
Aber, warum der Fehler dort kommt:
Method ‘helloFuc’ with Objective-C selector ‘helloFunc:’ conflicts with previous declaration with the same Objective-C selector
Ich nehme das Bild:
Warum kommt das Problem, wenn Swift
Funktion Überladung legal ist?
Das ist ein schlechtes Duplikat für diese Frage. Ein viel besser wäre http://stackoverflow.com/questions/29457720/compiler-error-method-with-objective-c-selector-conflicts-with-previous-declara?s=1|6.5289 – rmaddy