I want to create menu like in Files App. I added buttons but I dont know how can I create menu like this in SwiftUI. Do you have any id?
.navigationBarItems(trailing: Button(action: { }) {
Image(systemName: "ellipsis.circle")
.font(.system(size: 21))
})
In SwiftUI 2 you can use a Menu
placed in a Toolbar
:
struct ContentView: View {
var body: some View {
NavigationView {
Text("Test")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Menu(content: {
Button("Option 1", action: {})
Button("Option 2", action: {})
Button("Option 3", action: {})
}) {
Image(systemName: "ellipsis.circle")
.font(.system(size: 21))
}
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With