mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-14 12:31:00 +00:00
35 lines
981 B
Swift
35 lines
981 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import SwiftUI
|
|
|
|
@main
|
|
struct MetatextApp: App {
|
|
private let environment: AppEnvironment
|
|
|
|
init() {
|
|
let identityDatabase: IdentityDatabase
|
|
|
|
do {
|
|
try identityDatabase = IdentityDatabase()
|
|
} catch {
|
|
fatalError("Failed to initialize identity database")
|
|
}
|
|
|
|
environment = AppEnvironment(
|
|
URLSessionConfiguration: .default,
|
|
identityDatabase: identityDatabase,
|
|
defaults: Defaults(userDefaults: .standard),
|
|
keychainService: KeychainService(serviceName: Self.keychainServiceName),
|
|
webAuthSessionType: WebAuthSession.self)
|
|
}
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView(viewModel: RootViewModel(identitiesService: IdentitiesService(environment: environment)))
|
|
}
|
|
}
|
|
}
|
|
|
|
private extension MetatextApp {
|
|
static let keychainServiceName = "com.metabolist.metatext"
|
|
}
|