Reputation: 43
I've recently been learning swift and upon opening a project from a previous beta version I get this error when trying to compile
Overriding method with selector 'initWithStyle:reuseIdentifier:' has incompatibe type '(UITableViewCellStyle, String) -> SweetTableViewCell'
And here's the line of code giving the error
override init(style: UITableViewCellStyle, reuseIdentifier: String) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// Initialization code
}
Upvotes: 4
Views: 495
Reputation: 72760
That's because the init
method in UITableViewCell
has been changed a little bit:
init(style: UITableViewCellStyle, reuseIdentifier: String?)
^
the reuseIdentifier
is now an optional string.
Upvotes: 3
Reputation: 21003
Apple makes many arguments and method values optional in new XCode versions. In your case the second argument - reuseIdentifier
- should be String?
not String
.
Upvotes: 1