All works

Case study · Kotlin Multiplatform · MVI · Internal

YAMVIP

YAMVIP (Yet Another MVI Presenter): a multiplatform MVI engine that shares presentation logic between Android and iOS, with a strict split between Model, UIState, Intent and Effect.

Delivered at MerkleEnterprise mobile & digital engineering

Context
Internal engineering at Merkle
My role
Contributor: implementation and design
Period
Sep 2023 – Oct 2024 (approx.)
Platform
Kotlin Multiplatform · StateFlow

The idea

Sharing business logic in Kotlin is common; sharing presentation logic is harder. YAMVIP gives both apps the same presenters, so screens behave the same on Android and iOS and can be unit-tested once.

It favours convention over configuration and a good developer experience.

What I did

  • Worked on the presenter pattern: every presenter extends YamviPresenter, typed by its Model, UIState and Effect.
  • Separated the internal Model from the UIState that the UI renders, joined by a mapper.
  • Handled intents with a reducer that produces the next Model, exposed as StateFlow.
  • Kept Effects for one-shot events only, as a last resort.
  • Wrote examples and discussed the patterns with the team.

The loop

  1. Intent

    • What the user did
  2. Reducer

    • Intent → new Model
  3. Model

    • Internal state
  4. Mapper

    • Model → UIState
  5. UIState & Effect

    • Rendered by Compose and SwiftUI
    • One-shot events

Stack

  • Kotlin Multiplatform
  • Coroutines
  • StateFlow
  • Compose
  • SwiftUI
  • Unit tests

Team

Built by the internal mobile engineering team at Merkle, as internal reference work.

The result

A shared presentation layer the team used as a reference, later part of the KMP Template.

Next case study KMP Template