AceMobileInterview

iOS track

General topic questions

View controller lifecycle

EasyMost asked

Free section · general topics & algorithms

Walk through the UIViewController lifecycle and where you would load data, configure UI, and clean up observers.

Reveal model answer
loadView → viewDidLoad (one-time setup) → viewWillAppear → viewIsAppearing → viewDidAppear → viewWillDisappear → viewDidDisappear → deinit. Load remote data after first appear or via a dedicated loader; remove NotificationCenter/KVO observers in deinit or viewDidDisappear depending on scope; cancel in-flight tasks when the screen disappears if results are no longer needed.
Delegates vs Closures