prevent retain cycle in Swift function pointers
问题 How do I prevent a retain cycle when passing around functions as objects in Swift Imagine you have a datasource object like this import UIKit class MagicDataSource:NSObject,UITableViewDatasource { deinit { println("bye mds") } //cant use unowned or weak here var decorator:((cell:CustomCell)->Void)? func tableView(tableView:UITableView,cellForRowAtIndexPath indexPath:NSIndexPath)->UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier(Identifier, forIndexPath: indexPath) as