Skip to content

Instantly share code, notes, and snippets.

@tapwork
tapwork / weakselfdance.swift
Created August 28, 2018 11:37
Example of wrong [weak self] usage
class Dad {
func start() {}
deinit { print("Destroying \(String(describing: self))\n\n") }
func log(_ msg: String) { print(msg) }
func workSlow() { usleep(500) }
}
// The bad son will not finish the task
class BadSon: Dad {
override func start() {