metatext/View Models/SecondaryNavigationViewModel.swift
2020-08-26 21:04:06 -07:00

24 lines
739 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 preferencesViewModel() -> PreferencesViewModel {
PreferencesViewModel(identityService: identityService)
}
}