UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Hacking with watchOS: SwiftUI Edition Project 4

Forums > watchOS

I was following the book and then ran into a bit of an issue during the selecting favorite currencies part. The book says to open Project4App.swift and make changes except my files don't have anything that looks like the code in the book. I have something similar named HostingController.swift but the code looks like this

import WatchKit
import Foundation
import SwiftUI

class HostingController: WKHostingController<ContentView> {
    override var body: ContentView {
        return ContentView()
    }
}

where the book has

@main
struct Project4RemakeApp: App {
    var body: some Scene {
        WindowGroup {
            NavigationView {
                ContentView()
            }
        }
    }
}

Is this where I should make the changes on what file to be the first one that gets opened up when the program launches?

5      

@twostraws  Site AdminHWS+

I know we already spoke on Twitter, but in case it helps others: you should use the SwiftUI app lifecycle.

5      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.