article

Friday, May 7, 2021

SwiftUI How to show a popover view

SwiftUI How to show a popover view
 
//
//  ContentView.swift
//  Testapp
//
//  Created by Cairocoders
//

import SwiftUI

struct ContentView: View {
    
    @State private var showpopover = false
    
    var body: some View {
        Button("Show menu") {
            showpopover = true
        }
        .popover(isPresented: $showpopover) {
            Text("Your content here")
                .font(.headline)
                .padding()
        }
           
    }
}

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

Related Post