All Projects → icerockdev → Moko Template

icerockdev / Moko Template

Licence: apache-2.0
Template project of a Mobile (Android & iOS) Kotlin MultiPlatform project with the MOKO libraries and modularized architecture

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Moko Template

Uniapp Admin
Muti-platform management system for uniapp, H5, Android, IOS, Min Program
Stars: ✭ 226 (-5.83%)
Mutual labels:  template
Github Issue Templates
🔣 A collection of GitHub issue and pull request templates
Stars: ✭ 3,074 (+1180.83%)
Mutual labels:  template
Vben Admin Thin Next
vue-vben-admin-2.0 mini template.vue3,vite,typescript
Stars: ✭ 232 (-3.33%)
Mutual labels:  template
Laravel Database Mail Templates
Render Laravel mailables based on a mail template stored in the database
Stars: ✭ 226 (-5.83%)
Mutual labels:  template
Projectmaker
A Sublime Text 2/3 plugin to allow creating any kind of project from your own custom templates
Stars: ✭ 233 (-2.92%)
Mutual labels:  template
Dot Github
.github directory generator
Stars: ✭ 237 (-1.25%)
Mutual labels:  template
Play Scala Rest Api Example
Example Play Scala application showing REST API
Stars: ✭ 227 (-5.42%)
Mutual labels:  template
Sodajs
Light weight but powerful template engine for JavaScript
Stars: ✭ 240 (+0%)
Mutual labels:  template
Mvparms Module Template
🛠 一键搭建 MVPArms 的官方架构, 让新手一秒即可开启 MVPArms 的世界, 免于项目繁琐配置的烦恼
Stars: ✭ 234 (-2.5%)
Mutual labels:  template
Extension Create
Create modern cross-browser extensions with no build configuration.
Stars: ✭ 167 (-30.42%)
Mutual labels:  template
Latex Ppt Template
Seven awesome latex ppt templates for researchers or students.
Stars: ✭ 229 (-4.58%)
Mutual labels:  template
React Firebase Admin
React ⚛️ starter kit with Firebase 🔥 and Bulma for setting up an admin dashboard - Highly scalable, PWA, Serverless
Stars: ✭ 232 (-3.33%)
Mutual labels:  template
Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Stars: ✭ 2,864 (+1093.33%)
Mutual labels:  template
React Landing Page Template
A simple react one page landing page templates for startups/companies
Stars: ✭ 224 (-6.67%)
Mutual labels:  template
Wemake Python Package
Bleeding edge cookiecutter template to create new python packages
Stars: ✭ 235 (-2.08%)
Mutual labels:  template
Aspnetcore.template
ASP.NET core mvc project template for real world applications
Stars: ✭ 226 (-5.83%)
Mutual labels:  template
Scaffdog
🐶 scaffdog is Markdown driven scaffolding tool.
Stars: ✭ 237 (-1.25%)
Mutual labels:  template
Whu Thesis
📝 武汉大学毕业论文 LaTeX 模版 2021
Stars: ✭ 232 (-3.33%)
Mutual labels:  template
Typescript Starter
Quickly create and configure a new library or Node.js project
Stars: ✭ 2,953 (+1130.42%)
Mutual labels:  template
Generate
A new command line tool and developer framework for scaffolding out GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.
Stars: ✭ 238 (-0.83%)
Mutual labels:  template

moko-template
GitHub license kotlin-version

Mobile Kotlin multiplatform project template

A sample project that helps to start building a Mobile Kotlin Multiplatform application. It establishes an architecture optimized for building cross-platform mobile applications through separation of concerns between the UI and business logic.

Table of Contents

Features

  • Kotlin Multiplatform's motto is Don't Repeat Yourself. Share the business logic code written in Kotlin between Android and iOS apps. 100% native UI and performance (shared code compiles into native libraries);
  • Kotlin Gradle DSL – Configure project with flexible Kotlin Gradle DSL;
  • Modular-bazed architecture – Implement app features independently of each other. Inject dependencies into features at compile-time through the use of the Factory class;
  • Parallel build of modules – Feature modules and the domain module don't depend on each other. This provides caching of build artifacts for each module and results in better compilation time;
  • Dependencies definition in buildSrc - Simplify dependency management across modules;
  • Ready to use - Template project includes all moko libraries and supports most common use cases:
    • ViewModels;
    • LiveData;
    • Resource management;
    • Runtime permissions access;
    • Media access;
    • UI lists management from shared code;
    • Network layer generation from OpenAPI.

Modules

Legend

The color describes different modules and the shape - the type of an element (class|interface). legend

Modules scheme

modules scheme This scheme shows the structure of the project:

  • We have two applications that represent the View application layer:
    • android-app written in Kotlin uses Activity and Fragment;
    • ios-app written in Swift uses UIViewController with Storyboards.
  • Both applications depend on mpp-library (Kotlin Multiplatform) that provides access to ViewModel's of each feature through SharedFactory. The library is responsible for setting up connections between the feature and domain modules.
  • mpp-library consists of modules:
    • domain (Kotlin Multiplatform) - contains the domain entities, repositories, server API classes, and DomainFactory that creates instances for all of them;
    • feature (Kotlin Multiplatform). Every feature contains corresponding ViewModel, Factory, models, and interfaces it expects to be injected from the parent module. In this example:
      • config contains an config feature's ViewModel, data store interface and ConfigFactory that create instances of ViewModel;
      • list contains a items list feature's ViewModel, data source interface, list items factory interface, and ListFactory that create instances of ViewModel.

Config module scheme

config module scheme The connections between the feature:config classes and the domain classes implemented in the mpp-library module.

List module scheme

list module scheme The connections between the feature:list classes and the domain classes implemented in the mpp-library module.
SharedFactory.NewsUnitsFactory interface is implemented on both platforms - Android (android-app) and iOS (ios-app).

Screenshots

Android iOS
android-app ios-app
android-app ios-app

How to Run

Android - just open repository root directory in Android Studio and press Run.
iOS - run pod install in directory ios-app. Then open ios-app/ios-app.xcworkspace and press Run on simulator/device.

Project setup

Setup your own ApplicationId

Just like in other native apps
In android-app/build.gradle.kts change org.example.app in the following line:

applicationId = "org.example.app"

In Xcode project settings change Bundle Identifier.

Setup your own project name

Just like in other native apps
In android-app/src/main/res/values/strings.xml change value of app_name.
In Xcode project settings change Display name.

Setup your own app icon

Just like in other native apps
Put your android icon to android-app/src/main/res and setup usage in android-app/src/main/AndroidManifest.xml.
Put your iOS icon to ios-app/src/Assets.xcassets/AppIcon.appiconset.

Create new feature module

Create a file mpp-library/feature/myfeature/build.gradle.kts with the following content:

plugins {
    plugin(Deps.Plugins.androidLibrary)
    plugin(Deps.Plugins.kotlinMultiplatform)
    plugin(Deps.Plugins.mobileMultiplatform)
}

Add module to buildSrc/src/main/kotlin/Deps.kt:

object Deps {
    ...

    object Modules {
        ...

        object Feature {
            ...

            val myfeature = MultiPlatformModule(
                name = ":mpp-library:feature:myfeature",
                exported = true
            )
        }
    }
}

Add module to settings.gradle.kts:

include(":mpp-library:feature:myfeature")

Add dependency to module from the mpp-library in mpp-library/build.gradle.kts:

val mppModules = listOf(
    ...
    Modules.MultiPlatform.Feature.myfeature
)

Contributing

All development of template is performed in the master branch. Please send PRs with bug fixes to the master branch.

Please refer to the contributing guide for more details.

License

Copyright 2019 IceRock MAG Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].