iOS App Lifecycle, Xcode Projects & Capabilities

Scenes and app lifecycle, Info.plist, targets and schemes, capabilities and entitlements, and debugging in Xcode.

Intermediate · about 7 hours · difficulty 3/5

Learn first: Native iOS (Swift + SwiftUI), Swift Essentials

Before going deep on SwiftUI, get comfortable with how an iOS app is packaged and launched.

Lifecycle

In SwiftUI apps, the App struct declares WindowGroup scenes. Observe @Environment(\.scenePhase) to react when the app becomes active, inactive or background. iOS suspends backgrounded apps quickly and may terminate them without notice, so persist state early.

Project structure

  • Targets: the app, extensions (widgets, notification service), and test targets.
  • Schemes and build configurations: Debug vs Release, plus custom ones for staging.
  • Info.plist: bundle metadata and usage description strings (for example NSCameraUsageDescription) required before asking for permissions. Missing strings crash the app.
  • Capabilities and entitlements: push notifications, iCloud, Sign in with Apple, App Groups.
  • Asset catalogs for app icons, colours and images.

Debugging

Breakpoints, the LLDB console (po variable), the view hierarchy debugger, and Instruments for performance.

UIKit awareness

Many SDKs and older apps still use UIKit. UIViewRepresentable and UIViewControllerRepresentable wrap UIKit components for SwiftUI.

Good enough to move on: you can add a capability, add a permission usage string, create a staging configuration, and debug with breakpoints.

Key concepts

  • App, Scene and scenePhase
  • Targets, schemes and configurations
  • Info.plist and usage descriptions
  • Capabilities and entitlements
  • Asset catalogs
  • Debugging with breakpoints and LLDB
  • Wrapping UIKit in SwiftUI

Mini project

Build a journaling app that saves the current draft whenever the app goes to the background, with separate Debug and Staging configurations.

Check yourself

What happens if your app requests camera access without an NSCameraUsageDescription entry?

Free resources