我需要使一个Swift类符合协议以实现委托。我该如何做?
class YourClass: SuperClassIfAny, FirstProtocol, SecondProtocol {
}
UITableViewDataSource
要求你实现。func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
Xcode 6 beta 7略微更改了UITableViewDataSource协议的语法,以匹配以下两个必需实现的语法:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell!
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell