metatext/ViewModels/Sources/ViewModels/Entities/Identification.swift
Justin Mazzocchi fe6aa0f115
Autoplay
2020-10-18 22:26:58 -07:00

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)
}
}
}