/rick-and-morty-kmp

Kotlin Multiplatform client for the Rick and Morty API with iOS and Android sample

Primary LanguageKotlinMIT LicenseMIT

Rick and Morty KMP

A Kotlin Multiplatform project that creates an Http client library around the Rick and Morty API.

Setup

The Rick and Morty API client supports both Android & iOS and can be added to the common main dependencies. Replace $version with the latest version:

Maven Central

buildScript {
    repositories {
        mavenCentral()
    }
}

commonMain {
    dependencies {
        implementation("com.plusmobileapps:rick-and-morty-api:$version")
    }
}

Usage

The API client itself can be accessed through RickAndMortyApi.instance where all of the following methods can be used.

// in a coroutine 
val characters = RickAndMortyApi.instance.getCharacters(page = 1)

Samples

Android Sample

You can run the Android app itself from Android Studio or run the following command from the terminal to build and install on an Android device that is running.

./gradlew :sample:androidApp:installDebug

iOS Sample

Open the sample/iosApp/iosApp.xcworkspace file or run the following command to open the iOS project.

cd sample/iosApp/
pod install
xed .

Libraries Used

API Client

Samples

Resources