NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

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.

   

Hacking with Swift is sponsored by Fernando Olivares

SPONSORED Would you describe yourself as knowledgeable, but struggling when you have to come up with your own code? Fernando Olivares has a new book containing iOS rules you can immediately apply to your coding habits to see dramatic improvements, while also teaching applied programming fundamentals seen in refactored code from published apps.

Try the book!

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

You are not logged in

Log in or create account
 

Link copied to your pasteboard.