From the course: iOS Development: Architecture
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Demo: Define the states
- [Instructor] To illustrate the App State and the transitions, we're going to build a sample app. But first, let's take a look at the complete state machine of an iOS app. The state chart diagram shows all the possible states and the events that trigger the transitions. We'll create a single view app. I call it App State Transitions, and let's save it to the working projects folder. The generated App Delegate has some of the UI application delegate methods. We're gonna add some plain statements to make the state changes visible. But first, I'll introduce an enum that represents these states, from not running to terminated. I call the enum App State. So, I define all the different state values in this enum. Not running, launching, initialized, active, inactive, waking up, background, and terminating. I make the app state enum conform to the custom string convertible (mumbles). This lets us assign custom string representations to the enum values and display them in the console. So, I'm…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.