Created
March 2, 2020 18:51
-
-
Save almaleh/b9ba2e157dde40ff44d8b2782131c91c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewControllerB: UIViewController { | |
var workItem: DispatchWorkItem? | |
override func viewDidLoad() { | |
let view = self.view | |
let workItem = DispatchWorkItem { | |
UIView.animate(withDuration: 1.0) { [weak self] in // this leaks | |
view?.backgroundColor = .red | |
} | |
} | |
self.workItem = workItem | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment