[Solved] SwiftUI – how to observe(.sink/ .onReceive) PassthroughSubject inside a View [closed]
If you have a Struct as Model or ViewModel and you need to update your SwiftUI View here it is how to do just that with SwiftUI + Combine. import Combine struct ViewModel { var textChangedPublisher: AnyPublisher<String, Never> { textChangedSubject.eraseToAnyPublisher() } private let textChangedSubject = PassthroughSubject<String, Never>() func triggerUpdate() { let newStr = DateFormatter().string(from: Date()) … Read more