/GitHubUserFinderKMM

Kotlin Multiplatform Mobile sample project with Jetpack Compose and SwiftUI

Primary LanguageKotlin

GitHubUserFinderKMM

GitHub Actions build status GitHub Actions build status

Kotlin Multiplatform Mobile sample project with Jetpack Compose and SwiftUI

Check this basic, simple KMM project with latest and greatest libraries. You can also easily learn and keep your knowledge up-to-date in both Jeptack Compose and SwiftUI.

iOS Swift Android Kotlin GitHub

Android iOS

About the project

  • Shared ViewModels 🚀
  • MVVM + Reducer implementation = MVI
  • List and detail screens
  • Favourite user feature with SQLDelight
  • Simple paging functionality
  • Linter & formatter (detekt, swiftlint)
  • Dark mode
  • Error handling
  • Common tests
  • GitHub Actions config: GitHubUserFinderKMM-Android.yml + GitHubUserFinderKMM-iOS.yml
  • GitHub API
  • Coverage report (kover)

Libraries

Check Dependencies.kt for more details

Code coverage

  • 📋 Kover - Kotlin code coverage tool GitHub Repo stars Maven Central

Use ./gradlew koverMergedVerify koverMergedReport to verify and generate the coverage report with a custom rule:

kover {
        verify {
            rule {
                isEnabled = true
                name = "Minimum coverage verification error"
                target =
                    kotlinx.kover.api.VerificationTarget.ALL

                bound {
                    minValue = 80
                    maxValue = 100
                    counter =
                        kotlinx.kover.api.CounterType.LINE
                    valueType =
                        kotlinx.kover.api.VerificationValueType.COVERED_PERCENTAGE
                }
            }
        }
    }

After that we can use the Kotlinx Kover Report to add the coverage report to the PR as a comment

File Coverage [84.31%]
shared/src/androidMain/kotlin/io/imrekaszab/githubuserfinder/di/KoinAndroid.kt 33.33%
shared/src/androidTest/kotlin/io/imrekaszab/githubuserfinder/TestUtilAndroid.kt 55.56%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/database/CoroutinesExtensions.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/database/DatabaseHelper.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/di/Koin.kt 39.58%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/mapper/Mappers.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/model/domain/GitHubUser.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/repository/GitHubUserRepositoryImpl.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/service/GitHubUserService.kt 66.67%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/util/mvi/Reducer.kt 92.31%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/util/mvi/TimeCapsule.kt 66.67%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/details/GitHubUserDetailsModel.kt 91.67%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/details/GitHubUserDetailsViewModel.kt 93.55%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/favourite/FavouriteUsersModel.kt 90.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/favourite/FavouriteUsersViewModel.kt 100.00%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/list/GitHubUserListModel.kt 78.95%
shared/src/commonMain/kotlin/io/imrekaszab/githubuserfinder/viewmodel/list/GitHubUserListViewModel.kt 58.54%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/FavouriteUsersViewModelTest.kt 100.00%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/GitHubUserDetailsViewModelTest.kt 100.00%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/GitHubUserListViewModelTest.kt 100.00%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/GitHubUserServiceTest.kt 100.00%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/MockHttpClient.kt 85.37%
shared/src/commonTest/kotlin/io/imrekaszab/githubuserfinder/MockModule.kt 100.00%
Total Project Coverage 80.65%

Originally posted by @kaszabimre in apter-tech#17 (comment)

IDEs

  • Android Studio Dolphin | 2021.3.1 | with KMM plugin
  • Xcode 14.0.1

Dependency versions

This project is using a gradle-versions-plugin to manage dependency versions.

Checking for new versions

To check if dependencies are in need of updating:

./gradlew dependencyUpdates

What's next?

  • UI tests
  • Fancy animations