Browse Questions
Answer:
An iOS app moves through states managed by UIApplicationDelegate (UIKit) or @main + scene lifecycle (SwiftUI/iOS 13+).
States:
- Not Running — app hasn't launched or was terminated
- Inactive — foreground but not receiving events (e.g. incoming call)
- Active — foreground, running normally
- Background — executing code off-screen (limited time)
- Suspended — in memory but not executing
Key delegate methods (UIKit):
func application(_:didFinishLaunchingWithOptions:) // setup
func applicationDidBecomeActive(_:) // resume
func applicationWillResignActive(_:) // pause
func applicationDidEnterBackground(_:) // save state
func applicationWillTerminate(_:) // cleanup