38 items
App States & OS Process Death Recovery
FlashcardObserver Setup in viewWillAppear
Code QuizLifecycle Callbacks vs Object Deallocation
QuizApp State Transitions & Process Death
Slides / VideoOS Lifecycle vs React Component Lifecycle
FlashcardOS Lifecycle vs React Lifecycle
Slides / VideoAppState Foreground Detection Cleanup
Code QuizAppState & Lifecycle Mapping Across Platforms
QuizSaving State on App Lifecycle
Code QuizApp States and Transitions
QuizView Controller Lifecycle Cleanup
Code QuizBalancing View Controller Lifecycle Cleanup
QuizDetecting Backgrounding with AppState
Code QuizReact Native AppState Backgrounding
QuizWrong Method for Background Work
Code QuizUnderstanding the Inactive App State
QuizReact Native AppState & Backgrounding
Slides / VideoReact Native AppState Basics
FlashcardApp States and Background Transitions
QuizState Restoration and Cold Starts
QuizBackground Task Ends Too Early
Code QuizState Restoration Key Mismatch Bug
Code QuizuseEffect Cleanup in Mobile Apps
Slides / VideouseEffect Cleanup on Mobile
FlashcardProcess Death and State Restoration
Slides / VideoCold vs Warm Start & State Restoration
FlashcardApp State Transitions
FlashcarduseFocusEffect Re-run Bug
Code QuizView Controller Focus & Cleanup
QuizApp State Transitions Explained
Slides / VideoComponent Lifecycle & Screen Focus
Slides / VideoUIViewController Lifecycle & Focus
FlashcardSaving State on Background
Code QuizAppState Listener Cleanup Bug
Code QuiziOS App States Basics
QuizAppState & Component Lifecycle in RN
QuizAppState & Component Lifecycle in RN
Slides / VideoAppState & Component Lifecycle in RN
FlashcardObserver Setup in viewWillAppear
Spot why a notification observer added in viewWillAppear leaks and fires multiple times.
class FeedViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
NotificationCenter.default.addObserver(
self,
selector: #selector(refresh),
name: .dataDidUpdate,
object: nil
)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// cleanup handled in deinit
}
deinit {
NotificationCenter.default.removeObserver(self)
}
@objc func refresh() {
// reload feed data
}
}What is the bug in this view controller's lifecycle handling?