HomeiOS Developmentios - How navigate views with out utilizing NavigationStack/Hyperlink?

ios – How navigate views with out utilizing NavigationStack/Hyperlink?


Ought to I construct every little thing in a single view and conceal/present components as they're wanted?
Placing everthing into one View will not be actually how SwiftUI is meant for use.

Nonetheless it may be performed, see the instance code to reply your query
How navigate views with out utilizing NavigationStack/Hyperlink?

I am questioning if I am not supposed to construct separate views for every new display.
Sure, it is a good thought, it is extra modular and there are limits on how a lot you’ll be able to put into one view.

struct OverView: View {
    @State non-public var viewSelect = "Fundamental"
    
    var physique: some View {
        HStack {
            Picker("Choose", choice: $viewSelect) {
                ForEach(["Fight", "Skills", "Inventory", "Shop", "Main"], id: .self) {
                    Textual content($0)
                }
            }.pickerStyle(.segmented)
        }
        ZStack {
            change viewSelect {
                case "Battle": Textual content("Battle view")
                case "Abilities": Textual content("Abilities view")
                case "Stock": Textual content("Stock view")
                case "Store": Textual content("Store view")
                default: Textual content("Fundamental view")
            }
        }
        Spacer()
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments