metatext/Shared/View Models/IdentitiesViewModel.swift
Justin Mazzocchi 9659085ca6
Refactoring
2020-08-07 14:57:18 -07:00

22 lines
659 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Combine
import Foundation
class IdentitiesViewModel: ObservableObject {
@Published private(set) var identity: Identity
@Published var identities = [Identity]()
@Published var alertItem: AlertItem?
private let environment: IdentifiedEnvironment
private var cancellables = Set<AnyCancellable>()
init(environment: IdentifiedEnvironment) {
self.environment = environment
identity = environment.identity
environment.identitiesObservation()
.assignErrorsToAlertItem(to: \.alertItem, on: self)
.assign(to: &$identities)
}
}