Xcode 7 beta 5 Swift 2 redundant conformance to protocol error

前端 未结 1 328
遇见更好的自我
遇见更好的自我 2021-01-18 02:29

I recently download Xcode 7 which comes with Swift 2. Below is the error I get when I try to conform my class to UITableViewDataSource and UITableViewDele

1条回答
  •  伪装坚强ぢ
    2021-01-18 03:20

    There is no need to indicate that you TableViewController conforms to the two protocols because the UITableViewController already does. So your class will as well due to the inheritance.

    All you need is:

    class TableViewController: UITableViewController {
    }
    

    It seems Swift2 is more strict about this than Swift is.

    0 讨论(0)
提交回复
热议问题