metatext-app-ios-iphone-ipad/ViewModels/Sources/ViewModels/Entities/Identification.swift

25 lines
713 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Combine
import Foundation
import ServiceLayer
public final class Identification: ObservableObject {
@Published private(set) public var identity: Identity
@Published public var appPreferences: AppPreferences
let service: IdentityService
init(identity: Identity,
publisher: AnyPublisher<Identity, Never>,
service: IdentityService,
environment: AppEnvironment) {
self.identity = identity
self.service = service
appPreferences = AppPreferences(environment: environment)
DispatchQueue.main.async {
publisher.dropFirst().assign(to: &self.$identity)
}
}
}