我最近下载了 Swift 2 附带的 Xcode 7。下面是我尝试使我的类符合 UITableViewDataSource
和 UITableViewDelegate
时出现的错误,它们在Xcode 6.2 但在 Xcode 7 beta 5 中抛出错误
class TableViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate {
}
//error: Redundant conformance of 'TableViewcontroller' to protocol 'UITableViewDataSource'
我已经在谷歌上搜索了答案,但我找不到解决办法。
最佳答案
没有必要表明您的 TableViewController
符合这两个协议(protocol),因为 UITableViewController
已经这样做了。因此,由于继承,您的类(class)也将如此。
您只需要:
class TableViewController: UITableViewController {
}
似乎 Swift2 对此比 Swift 更严格。
关于ios - Xcode 7 beta 5 Swift 2 冗余符合协议(protocol)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32163313/