metatext/View Models/SecondaryNavigationViewModel.swift

25 lines
739 B
Swift
Raw Normal View History

2020-07-31 21:40:57 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-07 03:57:52 +00:00
class SecondaryNavigationViewModel: ObservableObject {
2020-08-04 20:26:09 +00:00
@Published private(set) var identity: Identity
2020-08-08 23:08:47 +00:00
private let identityService: IdentityService
2020-07-31 21:40:57 +00:00
2020-08-08 23:08:47 +00:00
init(identityService: IdentityService) {
self.identityService = identityService
identity = identityService.identity
identityService.$identity.dropFirst().assign(to: &$identity)
2020-07-31 21:40:57 +00:00
}
}
2020-08-04 20:26:09 +00:00
2020-08-07 03:57:52 +00:00
extension SecondaryNavigationViewModel {
2020-08-04 20:26:09 +00:00
func identitiesViewModel() -> IdentitiesViewModel {
2020-08-08 23:08:47 +00:00
IdentitiesViewModel(identityService: identityService)
2020-08-04 20:26:09 +00:00
}
2020-08-07 10:14:14 +00:00
2020-08-07 10:59:48 +00:00
func preferencesViewModel() -> PreferencesViewModel {
2020-08-08 23:08:47 +00:00
PreferencesViewModel(identityService: identityService)
2020-08-07 10:14:14 +00:00
}
2020-08-04 20:26:09 +00:00
}