| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // TodosApp.swift
- // Todos
- //
- // Created by Sam Jaffe on 2/28/26.
- //
- import SwiftUI
- import SwiftData
- struct UserDefaultsKeys {
- private static let root = "leumasjaffe.Todos"
- static let UrlHints = root + ".URLHints"
- static let WeekStart = root + ".WeekStart"
- static let Category = root + ".Category"
- }
- @main
- struct TodosApp: App {
- var sharedModelContainer: ModelContainer = {
- let schema = Schema([
- Project.self,
- Task.self,
- SubTask.self,
- Tag.self
- ])
- let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
- do {
- return try ModelContainer(for: schema, configurations: [modelConfiguration])
- } catch {
- fatalError("Could not create ModelContainer: \(error)")
- }
- }()
- var body: some Scene {
- WindowGroup {
- ContentView().onAppear {
- // Disable the tab bar options
- NSWindow.allowsAutomaticWindowTabbing = false
- }
- }
- .modelContainer(sharedModelContainer)
- .commands {
- CommandGroup(replacing: .newItem) {
- NewProjectMenu()
- .modelContainer(sharedModelContainer)
- }
- CommandGroup(replacing: .saveItem) {
- SaveSnapshotMenu()
- .modelContainer(sharedModelContainer)
- SaveAsMenu()
- .modelContainer(sharedModelContainer)
- ExportMenu()
- .modelContainer(sharedModelContainer)
- ImportMenu()
- .modelContainer(sharedModelContainer)
- }
- }
- #if os(macOS)
- Settings {
- SettingsView()
- }
- #endif
- }
- }
|