Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS Web Standards like JS - kind of Ionic / Cordova HTML + CSS React UI Components Redux OS Bridge i.e. Camera HTTP native
Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS Java Script React Native Native UI React Redux OS Bridge i.e. Camera HTTP native native
Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS C# (compiles arm, Runtime) Xamarin Xamarin Forms ViewModel BLoC Redux OS Bridge i.e. Camera HTTP native Native UI native
Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS Dart (compiles native arm) Flutter UI Drawing Components BLoC Redux OS Bridge i.e. Camera HTTP native
Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS C++ / JNI C++ / Rust / Swift Logic OS HTTP native View native ViewModel Navigation Business
Rules Navigation Interactor Use Case Repository DAO DB - HTTP - FS Kotlin (JVM, ARM) Kotlin Native Business Logic OS HTTP native View native ViewModel Navigation
View ViewModel Navigation Business C++ / Rust Kotlin Native Native UI React Xamarin Forms Redux OS Bridge i.e. Camera HTTP Xamarin React Native UI Drawing Components BLoC Redux OS Bridge i.e. Camera HTTP Flutter HTML React Redux HTTP GraphQL Ionic Web OS Bridge
_, setState -> setState { state -> val timeLeft = state.timeLeft - 1 if (timeLeft >= 0) { CountdownState(timeLeft) } else { createFirstExerciseState(rounds) } } } } data class CountdownState( val timeLeft: Int )
getState, setState -> setState { state -> createNextExerciseState(state, rounds) } } } data class ExerciseState( override var secondsElapsed: Long = 0, override var currentRoundIndex: Int = 0, override var currentExerciseIndex: Int = 0, override var workoutProgress: Int = 0, override var nextExercise: RoundExercise? )
single round") { //initialize StateMachine and required data here val state = stateMachine.state.record() And("the user wants to do the workout") { When("it starts") { Then("it starts with a countdown and 5 seconds left") { state shouldEmitNext WorkoutState.CountdownState(5) } } for (i in 4 downTo 0) { When("One countdown second elapsed") { countdown.nextTick() Then("Time left in CountdownState is $i") { state shouldEmitNext WorkoutState.CountdownState(i) } } } //When(...) When("Next Button clicked") { stateMachine.nextExercise() Then("next exercise state is emitted") { state shouldEmitNext RepExerciseState(...) } } }
as possible! How did we achieve that goal? - Fragment / ViewController -> ViewModel -> StateMachine -> Repository -> DB/API - Make it easy to render the UI! (By using a state machine which is easy to read and test) CONFIDENTIAL FREELETICS GMBH Main goals
had a hard time catching up to changes - Coroutines can only be used in Kotlin - Features have to be possible on both platforms (e.g. background services) - There is not always an answer for your problem CONFIDENTIAL FREELETICS GMBH Challenges
state: State var body: some View { switch(state){ case let countdown as CountdownState: Countdown(timeLeft: countdown.timeLeft) case let exercise as ExerciseState: Exercise(exercise: exercise) } } }