metatext/Shared/MetatextApp.swift

36 lines
1 KiB
Swift
Raw Normal View History

2020-07-19 02:12:32 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
2020-07-19 02:06:12 +00:00
import SwiftUI
@main
struct MetatextApp: App {
2020-08-12 07:24:39 +00:00
// swiftlint:disable weak_delegate
#if os(macOS)
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
#else
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
#endif
// swiftlint:enable weak_delegate
private let identitiesService: IdentitiesService = {
let identityDatabase: IdentityDatabase
do {
try identityDatabase = IdentityDatabase()
} catch {
fatalError("Failed to initialize identity database")
}
2020-08-12 07:24:39 +00:00
return IdentitiesService(identityDatabase: identityDatabase, environment: .live)
}()
2020-07-19 02:06:12 +00:00
var body: some Scene {
WindowGroup {
RootView(
2020-08-12 07:24:39 +00:00
viewModel: RootViewModel(appDelegate: appDelegate,
identitiesService: identitiesService,
notificationService: NotificationService()))
2020-07-19 02:06:12 +00:00
}
}
}