Xcode 7 beta 5 Swift 2 冗余符合协议错误
Xcode 7 beta 5 Swift 2 redundant conformance to protocol error
我最近下载了 Xcode 7,它附带了 Swift 2。下面是我尝试使 class 符合 UITableViewDataSource
和 UITableViewDelegate
在 Xcode 6.2 中运行良好,但在 Xcode 7 beta 5
中抛出错误
class TableViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate {
}
//error: Redundant conformance of 'TableViewcontroller' to protocol 'UITableViewDataSource'
我已经搜索 google 寻找答案,但我找不到解决方法。
无需表明您 TableViewController
符合这两个协议,因为 UITableViewController
已经符合。因此,由于继承,您的 class 也将如此。
您只需要:
class TableViewController: UITableViewController {
}
Swift2 似乎比 Swift 更严格。
我最近下载了 Xcode 7,它附带了 Swift 2。下面是我尝试使 class 符合 UITableViewDataSource
和 UITableViewDelegate
在 Xcode 6.2 中运行良好,但在 Xcode 7 beta 5
class TableViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate {
}
//error: Redundant conformance of 'TableViewcontroller' to protocol 'UITableViewDataSource'
我已经搜索 google 寻找答案,但我找不到解决方法。
无需表明您 TableViewController
符合这两个协议,因为 UITableViewController
已经符合。因此,由于继承,您的 class 也将如此。
您只需要:
class TableViewController: UITableViewController {
}
Swift2 似乎比 Swift 更严格。