Last active
September 8, 2021 07:54
-
-
Save mattmook/cdef5add34bbb2a72960f1fe5b5673af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PostListViewModelStateObject : ObservableObject { | |
@Published public private(set) var state: PostListState | |
init(viewModel: PostListViewModel) { | |
self.state = viewModel.container.stateFlow.value as! PostListState | |
(viewModel.container.stateFlow.asPublisher() as AnyPublisher<PostListState, Never>) | |
.receive(on: RunLoop.main) | |
.assign(to: &$state) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment