PokeDex using Kotlin Multiplatform

Related tags

Kotlin PokeDex-KMP
Overview

PokeDex KMP

License Android CI

A Demo Application for demonstrating code reuse in Both Android and iOS apps using Kotlin Multiplatform (KMP). Some extra specs:

  • 100% Kotlin for Android and KMP module.
  • 100% Swift for iOS.
  • Kotlin: 1.6.21
  • Test Driven Development
  • MVVM design pattern
  • Multi Module KMP Application Setup
  • Dependency Injection using Dagger Hilt - Android
  • Unit Testing via kotest and Mockk
  • Multithreading using Kotlin Coroutines.
  • Multiplatform Database using SQLDelight
  • Multiplatform Network Client using Ktor
  • Ktlint for lint.
  • KMP Modules Deployment as libraries for external Android and iOS apps.
  • Jetpack Compose.
  • SwiftUI.
  • Firebase Crashlytics. Add google-services.json for Android and GoogleService-Info.plist for iOS.
  • Kermit - Better iOS Crash Report Logging on Kotlin code crashes.

Blog for more details

Why KMP?

All advantages and freedom of native development + code re-usability in other platforms

Source Line of Code Stats:

Common Module (KMP)

Module sloc count
helpers 491
core 289
feature_pokemon_list 428
Total 1208

Host apps (Containing views and di code)

App sloc count exclusive code % common code %
android 210 17.38% 82.62%
ios 130 10.76% 89.24%

Around ~80% code written for a feature can be reused for other platform using KMP.

Screenshots

Android iOS

Architecture

Overview

Module Structure

  • helpers - Generic helper methods for mobile apps
  • core - Application specific common code which are shared by mostly all feature modules
  • feature_* - Feature module
  • shared - Umbrella module for ios. This module loads all sub gradle modules and creates a single framework file for adding to ios project.
  • android - Android host app
  • ios - iOS host app

Application Structure

Each individual feature folder structure

  • /data (All data related files)

    • /entity_1 (for e.g: Person)
      • /model
      • /dao
      • /network
      • repository
  • /presentation (All view related files)

    • /component_1 (for e.g: Person List)
      • /fragment
      • /viewmodel
      • /adapter
      • /view

Deployment as library

  • The KMP libraries can be directly accessed by the embedded Android and iOS module in this project.
  • If these KMP libraries is to be used as independent libraries in external Android / iOS apps, it can be published to maven repository.
    • publishToMavenLocal task will build and upload the KMP modules as libraries in local maven server which can be used to work in external android/ios apps in same machine.
    • publish task will build and upload the KMP modules as libraries in remote maven server which can be accessed from any machine. Remote maven configuration to be added in plugins/publish.gradle.
  • For Android, the process is simple as adding gradle dependencies in the Android app to load these hosted libraries.
  • For iOS, reference can be taken from this project or follow this guide. Pro tip: Keep KMP files inside a folder and not at root level to keep it encapsulated from native iOS project files and modify the configuration to support this.

TODO

iOS

  • Test cases
  • UI Event handling
  • Dependency injection framework
  • CI

Common

  • Code Generation templates

Resources

Pokemon Data

PokeAPI - The RESTful Pokémon API

All the Pokémon data you'll ever need in one place, easily accessible through a modern RESTful API.

App Icon

License

Copyright 2022 Harshith Shetty ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You might also like...
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project

Newsout Android and iOS mobile client for Nextcloud news App. The Android client is already available to download in the Play Store. F-Droid and Apple

Kotlin Multiplatform Application to show Crypto Coins
Kotlin Multiplatform Application to show Crypto Coins

This is the codebase of Crypto currency Tracking Kotlin Multiplatform App. Components Shared Components Ktor (Network Client) SQL Delight (Local DB) A

Dependency Injection library for Kotlin Multiplatform, support iOS and Android

Multiplatform-DI library for Kotlin Multiplatform Lightweight dependency injection framework for Kotlin Multiplatform application Dependency injection

Kotlin multiplatform library template.

template-kmp-library Kotlin multiplatform library template. Has a baseline setup for a multiplatform library supporting all kotlin targets except andr

BuildConfig for Kotlin Multiplatform Project

BuildKonfig BuildConfig for Kotlin Multiplatform Project. It currently supports embedding values from gradle file. Table Of Contents Motivation Usage

Kotlin multiplatform benchmarking toolkit

NOTE: Starting from version 0.3.0 of the library: The library runtime is published to Maven Central and no longer published to Bintray. The Gradle plu

Gradle plugin for simplify Kotlin Multiplatform mobile configurations
Gradle plugin for simplify Kotlin Multiplatform mobile configurations

Mobile Multiplatform gradle plugin This is a Gradle plugin for simple setup of Kotlin Multiplatform mobile Gradle modules. Setup buildSrc/build.gradle

Generic AST parsing library for kotlin multiplatform

kotlinx.ast kotlinx.ast is a generic AST (Abstract Syntax Tree) parsing library, Kotlin is currently the only supported language. The library is desig

KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.
KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

Owner
Harshith Shetty
Can develop anything
Harshith Shetty
Unsplash application for Android, Desktop and Web. Built using Kotlin Multiplatform and Compose

Unsplash Unsplash application for Android, Desktop and Web. Built using Kotlin Multiplatform and Compose with ❤️ ?? Presentation Set up the environmen

Carlos Mota 15 Nov 11, 2022
This is a Kotlin multiplatform template project used to generate and deploy a natively compiled AWS lambda function using the custom runtime.

Overview This is a Kotlin multiplatform template project used to generate and deploy a natively compiled AWS Lambda function using a custom runtime. U

Greg Steckman 5 Jun 25, 2022
Kotlinx-murmurhash - Kotlin Multiplatform (KMP) library for hashing using MurmurHash

kotlinx-murmurhash Kotlin Multiplatform (KMP) library for MurmurHash, a non-cryp

Gonçalo Silva 23 Dec 27, 2022
Kotlin Multiplatform Mobile application built using that consumes WakaTime API

Kotlin Multiplatform Mobile application built using that consumes WakaTime API ⏱️ to display user's coding stats such as day's or day's of weeks coding time, coding time for various programming languages or worked on projects etc. on various platforms.

Victor Kabata 17 Nov 30, 2022
A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and okio

Store A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisatio

Isuru Rajapakse 98 Jan 3, 2023
🍭 GithubSearchKMM - Github Repos Search - Android - iOS - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Dependency Injection, shared KMP ViewModel, Clean Architecture

GithubSearchKMM Github Repos Search - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Depend

Petrus Nguyễn Thái Học 50 Jan 7, 2023
Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in Kotlin with Jetpack Compose and a backed in Kotlin hosted on AppEngine.

Conferences4Hall Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in K

Gérard Paligot 98 Dec 15, 2022
Opinionated Redux-like implementation backed by Kotlin Coroutines and Kotlin Multiplatform Mobile

CoRed CoRed is Redux-like implementation that maintains the benefits of Redux's core idea without the boilerplate. No more action types, action creato

Kittinun Vantasin 28 Dec 10, 2022
An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.

An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile. 项目架构主要分为原生系统层、Android/iOS业务SDK层、KMM SDK层、KMM业务逻辑SDK层、iOS sdkfra

libill 4 Nov 20, 2022
A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android

Blue-Falcon A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has t

Andrew Reed 220 Dec 28, 2022