BLACK FRIDAY: Save 50% on all books and bundles! >>

Hacking with watchOS: SwiftUI Edition Project 4

Forums > watchOS

@clc80  

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?

   

@twostraws  Site AdminHWS+

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

   

I tried this coding with my new blog of toaster reviews and its working perfecly fine.

   

Save 50% in my Black Friday sale.

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

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

Not logged in

Log in
 

Link copied to your pasteboard.