Xcode 6.0에서 완벽하게 작동하는 사용자 지정 UITableViewCel (멋진 기능 없음)이 있습니다.Xcode 6.1에서 사용 가능한 초기화 도구
class MainTableViewCell: UITableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.setup()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.setup()
}
func setup() {<...>}
}
솔루션으로 컴파일러는 Propagate the failure with 'init?'
제안 :
여기 A non-failable initializer cannot chain to failable initializer 'init(style:reuseIdentifier:)' written with 'init?'
셀의 코드입니다 : 내가 엑스 코드 6.1 컴파일러로 컴파일하려고 다음과 같은 오류를 보여줍니다
override init?(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.setup()
}
나는 약간 혼란 스럽다. (non)failable initialiser
은 무엇이며 어떻게 사용해야하며 재정의해야합니까? 즉, nil
대신 인스턴스로 반환 할 수 초기화 - 스위프트 1.1
당신은 Xcode 6.0 및 6.1에 대해 사전에 말하고 있습니까? –
예, 당신 말이 맞아요, 거의 밤에 내가있는 곳이고 좀 졸 립니다. :) –
또한, 이해하고있는 것처럼 함수 맨 아래에 super.init 호출을 넣어야합니다. 당신이 재산이 없다면 그건 중요하지 않습니다. –