| 12345678910111213141516171819202122232425262728293031323334353637 |
- //
- // ExportMenu.swift
- // Todos
- //
- // Created by Sam Jaffe on 3/1/26.
- //
- import SwiftUI
- import SwiftData
- import UniformTypeIdentifiers
- struct ExportMenu: View {
- @Environment(\.modelContext) private var modelContext
-
- @Query private var items: [Category]
- @State private var showingExporter = false
- var body: some View {
- Button("Save As") {
- showingExporter = true
- }
- .keyboardShortcut("S", modifiers: [.command, .shift])
- .fileExporter(isPresented: $showingExporter, document: StubDocument(),
- contentType: .yaml) { result in
- switch result {
- case .success(let url):
- SaveController.save(items, to: url)
- case .failure(let error):
- print(error.localizedDescription)
- }
- }
- }
- }
- #Preview {
- ExportMenu()
- }
|