Swift UITableView delegate and dataSource declaration and retain cycles
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: As far as I understood, to use the delegate pattern in swift I had to declare a property like so: weak var delegate : TheDelegateProtocol ! And a protocol like so: @class_protocol protocol TheDelegateProtocol { } To avoid retain cycle and stick with what we are used to do in objective C. Now, if I look at what they have in the UITableView definition, I only see: var dataSource : UITableViewDataSource ! var delegate : UITableViewDelegate ! And: protocol UITableViewDelegate : NSObjectProtocol , UIScrollViewDelegate { [...] } I guess