Life cycle SwiftUI App has no SceneDelegate

I’m in Chapter 2. I wanted to initialize the color let constants in the SceneDelegate, but there wasn’t one. It seems that I’d changed Life cycle on the New, Project from UIKit App to SwiftUI app.

I think I’m good going forward, but can you briefly describe why there are two lifecycle options and whether there was an easier fix to picking the wrong one at the start than recreating the entire app? Is the new option documented anywhere in the forum for this book?

1 Like

hi! Xcode 12 has an App instead of a SceneDelegate. ContentView() is in the WindowGroup closure. Just replace it there:

struct RGBullsEyeApp: App {
  var body: some Scene {
    WindowGroup {
      ContentView(rGuess: 0.5, gGuess: 0.5, bGuess: 0.5)

We’re updating the book for Xcode 12 now.

Thank you. I’m looking forward to the new edition.

Hello @audrey.
Really like what you and the team have done with this book. It is awesome content!

Any estimated release date for the updated version of the book?

Thank you in advance!

thanks @vladr! glad you like it

pinging our managing editor about the release date: @mandafrederick

1 Like