Refreshing a window with new contents upon interaction

I’m attempting something seemingly simple yet I can’t find much information on how to do it. I have a simple program written in swift that originally opens swift proceses e.g. Process() and runs apple script snippets to populate dialog boxes with user interaction such as clicking yes/no buttons, entering text in text fields and capturing that data to do things with. I thought this would be an easy conversion to just do it in swiftui. The original version was not transitioning to the next window after clicking the “yes” button and we realized it may have been due to an additional popup from the os itself asking for permission to run system events. I simply want to make a mac os application that pops a dialog box that asks for a user’s id in a text field. After the user enters that and hit’s the ok button, the dialog refreshes (doesn’t populate a new window) with a new text field that asks for a users password in two additional text fields. After the user hits ok again the program does some processing etc. I’m just focused on the window part here. I believe I need to make certain objects observable, perhaps the view, and this allows the view to be refreshed with new items but I’m not sure how to go about it. There’s plenty out there on how to do this with ios applications but not much out there about macOS applications. This is a base of what I have so far:

import SwiftUI
import Foundation
struct ContentView: View {
    var body: some View {
        VStack {
            Text("This application creates and configures a local\n account based on a provided id. Would you like to proceed?")
            HStack {
                Button(action: {
                    idNumber()
                }, label: {
                    Text("Yes")
                })
                Button(action: {
                    exit(1)
                }, label: {
                    Text("No")
                })
            }
        }
        .padding()
    }
}

where idNumber() is a failed attempt at creating another view to show the next stage of the process and to populate the text field for id number entry.