Skip to content

A SwiftUI extension to allow creating custom "Edit Menus" (UIMenuController)

License

Notifications You must be signed in to change notification settings

jayrhynas/EditMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EditMenu

A SwiftUI extension to allow creating custom "Edit Menus" (UIMenuController)

Example Usage

import SwiftUI
import EditMenu

struct ContentView: View {
    @State var showAlert = false
    
    var body: some View {
        HStack {
            Text("Hello, world!")
                .padding()
                .border(Color.white)
                .editMenu {
                    EditMenuItem("Copy") {
                        print("copy")
                    }
                    EditMenuItem("Show Alert") {
                        showAlert = true
                    }
                }
        }.alert(isPresented: $showAlert) {
            Alert(title: Text("This is an alert"))
        }
    }
}

About

A SwiftUI extension to allow creating custom "Edit Menus" (UIMenuController)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages