Skip to content

Instantly share code, notes, and snippets.

Created Apr 14, 2022
What would you like to do?
Medium articles - KMM with MVI+FSM
import SwiftUI
import Combine
import shared
public class TimerViewModelObservableObject : ObservableObject {
private var wrapped: TimerViewModel
@Published private(set) var state: TimerUiState
init(wrapped: TimerViewModel) {
self.wrapped = wrapped
state = wrapped.stateFlow.value as! TimerUiState
(wrapped.stateFlow.asPublisher() as AnyPublisher<TimerUiState, Never>)
.receive(on: RunLoop.main)
.assign(to: &$state)
deinit {
func settingTime() {
func setTime(seconds: Int32) {
wrapped.setTime(seconds: seconds)
//ramaining public functions...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment