우리가 알고 있듯이 Swift
언어는 함수 오버로딩을 허용하고 Objective-c
에서는 오버로드가 유효하지 않습니다.스위프트 오버로드 문제
왜 제공 :
내가 사진을 촬영 : 오류가 오는 이유Method ‘helloFuc’ with Objective-C selector ‘helloFunc:’ conflicts with previous declaration with the same Objective-C selector
import UIKit
class FuncOverLoad: NSObject {
func helloFuc (_ what:String) {
}
func helloFuc (_ what:Int) {
}
func helloFuc() -> String {
return "one"
}
func helloFuc() -> Int {
return 1
}
}
그러나 :
그래서 난 내 데모 프로젝트에서 테스트 문제가 있다면 Swift
함수 오버로드가 합법적입니까?
이 질문에 대해서는 중복 된 내용입니다. 훨씬 더 좋은 방법은 다음과 같습니다. http://stackoverflow.com/questions/29457720/compiler-error-method-with-objective-c-selector-conflicts-with-previous-declara?s=1|6.5289 – rmaddy