I have seen a lot of code that uses closure to initialize a var or lazy var which refer to self without the weak self syntax. Doesn't that create a risk of a retain cycle? Why doesn't the compiler flag that? Should it be a mandatory thing to always use weak self or unowned self when using closure of any kind as a safety measure?
e.g.
class Test {
lazy var tableView: UITableView = {
let tableView = UITableView(frame: self.view.bounds, style: .plain)
tableView.delegate = self
tableView.dataSource = self
return tableView
}
}()