Skip to content

Instantly share code, notes, and snippets.

@GuilhE
Created Apr 14, 2022
Embed
What would you like to do?
Medium articles - KMM with MVI+FSM
import SwiftUI
import shared
struct TimerView: View {
@StateObject private var viewModel = ViewModels().timerViewModel().asObservableObject()
@State private var currentProgress: Float = 0.0
var body: some View {
ZStack {
//...
CircularProgressView(progress: $currentProgress)
if(viewModel.state.isRestarting) {
//...
}
}
.onReceive(viewModel.$state, perform: { new in
currentProgress = new.progress
})
}
}
struct CircularProgressView: View {
@Binding var progress: Float
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment