KMMT : Kotlin Multiplatform Mobile Template

Kotlin Multiplatform Mobile Development Simplified

Kotlin License: MIT Platform

KMMT is a KMM based project template designed to simplify the KMM development. It uses a simplified approach that can be shared both in android and iOS easily.

Primary objective of this project is to help KMM Developers & promote KMM technology

image

Credits : KaMP Kit

Android.mp4


iOS.mp4


IDE Requirements

IntelliJ/Android Studio – Android & Shared Module

Xcode – iOS Project



Features

1. Simple Networking API ( Ktor )

Create API Services using BaseAPI class. All network responses are wrapped in Either data type

<div class="highlight highlight-source-kotlin position-relative" data-snippet-clipboard-copy-content="class JsonPlaceHolderServiceAPI : BaseAPI() {

override val baseUrl: String
get() = " https: jsonplaceholder.typicode.com " suspend fun getPosts(postId: Int): Either<List, NetworkFailure> {
return doGet {
apiPath(“comments?postId=$postId”)
}
}
suspend fun setPost(post: PostModel): Either {
return doPost(post) {
apiPath(“comments”)
}
}
}
“>

class JsonPlaceHolderServiceAPI : BaseAPI() {

    override val baseUrl: String
        get() = "https://jsonplaceholder.typicode.com/"

    suspend fun getPosts(postId: Int): Either<List<PostModel>, NetworkFailure> {
        return doGet {
            apiPath("comments?postId=$postId")
        }
    }

    suspend fun setPost(post: PostModel): Either<PostModel, NetworkFailure> {
        return doPost(post) {
            apiPath("comments")
        }
    }
}