TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

creating new views

Forums > SwiftUI

is there a way to create a new blank view.. like the this sheet view but without the .sheet... just a normal blank view?

without using Navigation View.... i just want to have 3+ views and just toggle threw them with buttons

Thanks..

import SwiftUI

struct DetailView: View { var body: some View { Text("Hello") } }

struct ContentView: View { @State var showingDetail = false

var body: some View {
    Button(action: {
        self.showingDetail.toggle()
    }) {
        Text("Show Detail")
    }.sheet(isPresented: $showingDetail) {
        DetailView()
    }

}

} struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.