30 lines
628 B
Swift
30 lines
628 B
Swift
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>()
|
|
}
|
|
}
|
|
}
|