Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 2.31 KB

README.md

File metadata and controls

48 lines (34 loc) · 2.31 KB

To-Do

A Kotlin Multiplatform to-do list app with SwiftUI and Compose UI frontends

🎶
Making a list
Checking it twice
Gonna try out declarative UIs
🎵

Android Image iOS Image

Shared code

The core logic in the shared module is implemented via SqlDelight in ToDo.sq. This is exposed in a Kotlin API by ToDoRepository.

The SKIE plugin is used to convert the Kotlin to a Swift-friendly API for the iOS app. Some extra manual conversion is done to move from a Kotlin data class to a Swift struct.

Unit tests verify the happy path for both repository classes, making use of the Turbine library for testing Flows. Not a whole lot new there if you're used to testing KMP code, but they're there to look at nonetheless.

Android code

The Android app in the androidApp modules is a single activity ToDoActivity which injects a ToDoRepository into composable views defined in ToDoComposables.kt. There is a fully interactable preview function ToDoListPreview() which exercises the UI without any dependence on the shared code by manually wiring in-memory state.

iOS code

The iOS app in the iosApp directory consumes the repository in ToDoApp.swift, and renders it via SwiftUI views defined in ToDoViews.swift. There is a fully interactable preview view defined in ToDoList_Previews which exercises the UI without any dependence on the shared code by manually wiring in-memory state.

The Swift code converts the Kotlin ToDo class to a Swift ToDo struct via utilities in ToDo.swift. This better matches typical Swift development practices, and it means that the SwiftUI views have no direct dependence on the Kotlin code, which apparently helps the preview work better.

Other Notes

The project is using Gradle 8.x.x and requires Java 17, you will need to make sure your gradle jvm is set to 17.