metatext/View Models/SecondaryNavigationViewModel.swift
Justin Mazzocchi b80fd9146a
Lists
2020-08-28 20:50:58 -07:00

28 lines
849 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
class SecondaryNavigationViewModel: ObservableObject {
@Published private(set) var identity: Identity
private let identityService: IdentityService
init(identityService: IdentityService) {
self.identityService = identityService
identity = identityService.identity
identityService.$identity.dropFirst().assign(to: &$identity)
}
}
extension SecondaryNavigationViewModel {
func identitiesViewModel() -> IdentitiesViewModel {
IdentitiesViewModel(identityService: identityService)
}
func listsViewModel() -> ListsViewModel {
ListsViewModel(identityService: identityService)
}
func preferencesViewModel() -> PreferencesViewModel {
PreferencesViewModel(identityService: identityService)
}
}