metatext/ViewModels/Sources/ViewModels/SecondaryNavigationViewModel.swift

31 lines
891 B
Swift
Raw Normal View History

2020-07-31 21:40:57 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-31 18:57:02 +00:00
import ServiceLayer
2020-07-31 21:40:57 +00:00
2020-09-01 07:33:49 +00:00
public class SecondaryNavigationViewModel: ObservableObject {
@Published public 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-09-01 07:33:49 +00:00
public 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-29 03:50:58 +00:00
func listsViewModel() -> ListsViewModel {
ListsViewModel(identityService: identityService)
}
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
}