Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1.4 KiB

  1. import SwiftUI
  2. @main
  3. struct WriteFreely_MultiPlatformApp: App {
  4. @StateObject private var model = WriteFreelyModel()
  5. #if os(macOS)
  6. @State private var selectedTab = 0
  7. #endif
  8. var body: some Scene {
  9. WindowGroup {
  10. ContentView()
  11. .environmentObject(model)
  12. .environment(\.managedObjectContext, PersistenceManager.persistentContainer.viewContext)
  13. // .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
  14. }
  15. #if os(macOS)
  16. Settings {
  17. TabView(selection: $selectedTab) {
  18. MacAccountView()
  19. .environmentObject(model)
  20. .tabItem {
  21. Image(systemName: "person.crop.circle")
  22. Text("Account")
  23. }
  24. .tag(0)
  25. MacPreferencesView(preferences: model.preferences)
  26. .tabItem {
  27. Image(systemName: "gear")
  28. Text("Preferences")
  29. }
  30. .tag(1)
  31. }
  32. .frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
  33. .padding()
  34. // .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
  35. }
  36. #endif
  37. }
  38. }