First button with command shortcut
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
import SwiftUI
|
||||
import SFSafeSymbols
|
||||
|
||||
private struct InsertableView<Command>: View where Command: InsertableCommand {
|
||||
|
||||
@State
|
||||
private var showSheet: Bool = false
|
||||
|
||||
var body: some View {
|
||||
Button(action: { showSheet = true }) {
|
||||
Label(Command.title, systemSymbol: Command.icon)
|
||||
}
|
||||
.sheet(isPresented: $showSheet) {
|
||||
InsertableCommandSheet<Command>()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct InsertableItemsView: View {
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text("Commands")
|
||||
.font(.headline)
|
||||
InsertableView<InsertableImage>()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user