TodosApp.swift 827 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // TodosApp.swift
  3. // Todos
  4. //
  5. // Created by Sam Jaffe on 2/28/26.
  6. //
  7. import SwiftUI
  8. import SwiftData
  9. struct UserDefaultsKeys {
  10. private static let root = "leumasjaffe.Todos"
  11. static let UrlHints = root + ".URLHints"
  12. }
  13. @main
  14. struct TodosApp: App {
  15. var sharedModelContainer: ModelContainer = {
  16. let schema = Schema([
  17. Category.self,
  18. ])
  19. let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
  20. do {
  21. return try ModelContainer(for: schema, configurations: [modelConfiguration])
  22. } catch {
  23. fatalError("Could not create ModelContainer: \(error)")
  24. }
  25. }()
  26. var body: some Scene {
  27. WindowGroup {
  28. ContentView()
  29. }
  30. .modelContainer(sharedModelContainer)
  31. #if os(macOS)
  32. Settings {
  33. SettingsView()
  34. }
  35. #endif
  36. }
  37. }