hardStudy question · answer published in Swift interview questions, so no pointsswiftmemory-management
unowned self in a network callback
The user closes this screen before the request finishes. What happens when the completion handler runs?
final class OrderViewController: UIViewController {
func load() {
api.fetchOrder { [unowned self] result in
self.render(result)
}
}
}Discussion 0
Join free to post in the discussion.
Related questions
- Safely unwrapping a Swift optionalMobile App Developer
- Swift struct assignment copiesMobile App Developer
- Swift class shared referenceMobile App Developer
- Decoding JSON with extra keysMobile App Developer
- let compared with varMobile App Developer
- What guard let is forMobile App Developer
- Giving an optional a defaultMobile App Developer
- Type of an optional chainMobile App Developer