Skip to content

razvanred/rest-countries-kmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‡΅πŸ‡ͺ REST Countries

CI ktlint

The one and only mobile application that displays the countries from the REST Countries API.

Device screenshot of the Countries screen on a Pixel 9A Device screenshot of the "Republic of Croatia" country detail screen on a Pixel 9A Device screenshot of the Countries screen on an iPhone 16 Device screenshot of the "Republic of Croatia" country detail screen on an iPhone 16

🌟 Tech stack

πŸ›οΈ A Multiplatform foundation

  • πŸ›‚ Separated Gradle subprojects for each data layer
  • πŸ’‰ Dependency Injection through Koin
  • 🌊 Async calls and Reactive Flows through Kotlinx Coroutines
  • 🌍 Remote fetching from the REST API through Ktor Client
  • πŸ“„ Data serialization through Kotlinx Serialization
  • πŸ” Caching on a local database with AndroidX Room
  • πŸ—‚οΈ Different data layer handling through Store
  • ❗️ Network errors clearly propagated through layers and displayed to the user
  • πŸ§ͺ Unit tests using:
  • 🧩 Shared build logic between subprojects through convention plugins

πŸ€– Android application

🍎 iOS application

  • 🎨 UI implemented using SwiftUI
  • πŸ’‰ Dependency Injection through Factory
  • πŸ“¦ Remote dependencies management through Swift Package Manager
  • 🧰 Xcode configuration files management through Tuist

πŸš€ Get started

For the Android app, just open the root folder with Android Studio, and make sure you are using the proper version by checking the Android Gradle plugin and Android Studio compatibility matrix.

For iOS, as mentioned above, we are using Tuist to generate the Xcode project file. In order to open the project, run the following commands from the project root folder:

cd ios-app
mise trust # Trusts the defined packages; make sure you have Mise En Place installed on your machine
mise install # Installs the needed packages for the environment
tuist install # Downloads the needed dependencies for the app project
tuist generate # Opens the project on Xcode

To edit the project configuration, simply run from the /ios-app path:

tuist edit

✏️ Want to contribute?

The following steps are recommended if you want to open a new PR to bring your contribution.

🧼 Format your code

If you want to contribute to the Android and/or Kotlin Multiplatform code, run the following command from the project root folder:

./gradlew spotlessApply # or gradlew.bat spotlessApply on Windows

For the iOS side, run from the project root folder:

cd ios-app
mise install # Fetches SwiftFormat
swiftformat .

πŸͺ Configure Git Hooks

To check the code formatting before committing your working copy, you can locally configure the Git Hooks available from this repository:

git config --local core.hooksPath .githooks

πŸ’Ÿ Huge thanks to…

  • Chris Banes, with his tivi.app: his project not only taught me during the years about the Android development, but also shaped me as a developer in a general way
  • Although I never participated to this event, the DroidKaigi conference applications helped me during the early stages of my journey, and I am deeply grateful for the hard work the team is putting every year
  • Now in Android: A fully functional Android app built entirely with Kotlin and Jetpack Compose
  • Clean Architecture for SwiftUI + Combine: SwiftUI sample app using Clean Architecture
  • All the contributors of the mentioned libraries
  • REST Countries API project