Learn Courses My Dashboard

Simulator is showing an older version of the app

When I press run to run the simulator for my app, it’s always taking me back to an old version of the app not the one I am currently working on, how do i fix this

What’s changed between the old version and new version?
Did this suddenly start happening?

Anything you click command + R it should run your current code

Here are two screenshots: 2nd one is of the screen that is supposed to show and the 1st one is the one that is actually showing on the simulator!image
image

Which View are you displaying in Smilon_AppApp?

I was trying to display the welcome view, so I can the. go through all of the them to see if the button works

So in Smilon_AppApp you have something similar to this?

@main
struct Smilon_AppApp: App {
    var body: some Scene {
        WindowGroup {
            WelcomeView()
        }
    }
}

I don’t think so, where would I put that at?

In the Smilon_AppApp file.

Actually its already there.

No, it’s not. It says ContentView(), not WelcomeView().

And that’s why you’re seeing a different version; you are not displaying what you think you are displaying.

If you want to show WelcomeView, you need to tell your code to display WelcomeView, not ContentView.

1 Like

Thank you that worked. I’m sorry for all the questions, one more question if I want it to go through all the screens, do I have to put each screen name under WindowGroup

NO! You should navigate between your screens using buttons, you can use the Canvas to view what each screen will look like, but there should only have return one View In the Window group

I’m sorry for all the confusion! I have buttons on the screens that are done, but for some some reason when I first join on the first screen it’s not taking to the next screen


Because you didn’t tell your Buttons to do anything. The action closures are empty.

For instance, from the second screenshot:

Button("Next") {
}

(Note also that you need a . in front of foregroundColor(Color.black))

Don’t take this the wrong way, but I think it would greatly benefit you to go back and do a refresher on the basics of SwiftUI. The questions you are asking are very fundamental to how it works.

1 Like

I’ve tried everything, I looked at the videos but Chris is using a different way to get to another screen and I looked at the basic of SwiftUi videos and still nothing, it’s completely different than mine, and I tried what you said and still didn’t work

Can someone please help me out!!

Because this is a completely separate question, can you make it a new topic and again include your code and what you’re trying to accomplish

Paste your code in as text, rather than providing a screenshot.

To format the code nicely, place 3 back-ticks ``` on the line above your code and 3 back-ticks ``` on the line below your code. The 3 back-ticks must be the ONLY characters on the line. The back-tick character is located on the same keyboard key as the tilde character ~ (which is located below the Esc key). You can also highlight an entire code block and click the </> button on the toolbar to wrap the block for you.

This also makes it easier for anyone assisting as they can copy the code and carry out some testing.