/Food2Fork-KMM

Kotlin Multiplatform project that gets network data from Food2Fork.ca

Primary LanguageKotlin

Food2Fork App Icon Food2Fork Recipe App

This is the codebase for an upcoming course featuring Kotlin Multiplatform Mobile.

Architecture

Shared Components

  1. Ktor (Network Client)
  2. SQL Delight (Caching Client)
  3. Kotlinx.datetime

Android Specific Components

  1. Jetpack Compose
  2. Jetpack Compose Navigation
    • (Single activity, zero fragments)
  3. Accompanist Coil
  4. Hilt
    • I decided to use AAC ViewModel because it gives so much state management stuff for free. Maybe in the future a shared viewmodel will be more practical. I'll talk about this in detail in the course.
    • See this tweet thread if you want to do some reading: https://twitter.com/ianhlake/status/1388517293005574144

iOS Specific Components

  1. SwiftUI


Important Configuration Information

Important Android Studio and gradle configuration information for this project.

Android Studio Version

I've been using "Android Studio Arctic Fox (2020.3.1) Canary 8". I was using a newer version but had some issues. If you want to decrease the probability that you will have random issues that I did not, use the same version as me.

You can download here: Android Studio Archive.

Kotlin Multiplatform Mobile Plugin

Make sure you install this plugin. It will make your life way easier.

The Kotlin Multiplatform Mobile (KMM) plugin makes it easier to develop a Kotlin Multiplatform Project in Android Studio.

Install here: Kotlin Multiplatform Mobile Plugin

build.gradle (shared)

Make sure your shared build.gradle contains this configurations block in the android{...} configuration section. The "getting started" guide on the kotlinlang.org website used to contain this but it doesn't anymore for some reason. Maybe it is not needed for newer versions of Canary. I'm not sure. But my projects do not build without it.

build.gradle.kts (shared)

... stuff

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(21)
        targetSdkVersion(30)
    }
    configurations { // <--- This
        create("androidTestApi")
        create("androidTestDebugApi")
        create("androidTestReleaseApi")
        create("testApi")
        create("testDebugApi")
        create("testReleaseApi")
    }
}

... more stuff

Kotlin Version

Make sure you have this setting in android studio:

Kotlin Multiplatform Talks

  1. Mitch Tabian
    1. Is Kotlin Multiplatform Ready for Production?
    2. KMM - Fragmented Podcast
  2. Daniele Barconcelli
  3. Ekaterina Petrova
  4. Dmitry Savvinov
  5. Kevin Galligan
  6. Ben Asher and Alec Strong