Git Product home page Git Product logo

moko-widgets-template's Introduction

moko-template
GitHub license kotlin-version

Mobile Kotlin multiplatform project template with MOKO widgets

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);
  • Build from common code – you can use only common code to create both Android and iOS apps;
  • Kotlin Gradle DSL – Configure project with flexible Kotlin Gradle DSL;
  • 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:
    • Widgets - multiplatform UI;
    • ViewModels;
    • LiveData;
    • Resource management;
    • Runtime permissions access;
    • Media access;
    • UI lists management from shared code;
    • Network layer generation from OpenAPI.

Screenshots

Android iOS
HelloWorld Android HelloWorld iOS

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.

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.

moko-widgets-template's People

Contributors

ahmetcj4 avatar alex009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ahmetcj4

moko-widgets-template's Issues

Connect new library(SQLDelight) to MOKO-Widgets-Template build.gradle.kts

Hi, i try connect SQLDelight to my app using MOKO-Widgets-Template, but after generates Gradle - MyApp(root) - Tasks - sqldelight
result: Task :mpp-library:generateAndroidDebugServerBaseInterface NO-SOURCE!!!
How correct connect new library to MOKO? Or which SQL library to use MPP with MOKO-Widgets-Template?

build.gradle.kts
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform")
id("dev.icerock.mobile.multiplatform")
id("dev.icerock.mobile.multiplatform-resources")
id("com.squareup.sqldelight")
}

sqldelight {
database("ServerBase") {
packageName = "org.example.mpp"
sourceFolders = listOf("mpp-library/src/commonMain/kotlin/sqldelight")
// schemaOutputDirectory = file("build/dbs")
}
// linkSqlite = false
}

android {
compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
    minSdkVersion(Versions.Android.minSdk)
    targetSdkVersion(Versions.Android.targetSdk)
}

}

val mppLibs = listOf(
Deps.Libs.MultiPlatform.mokoResources,
Deps.Libs.MultiPlatform.mokoWidgets,
)

setupFramework(
exports = mppLibs
)

dependencies {
mppLibrary(Deps.Libs.MultiPlatform.kotlinStdLib)
mppLibrary(Deps.Libs.MultiPlatform.coroutines)
mppLibrary(Deps.Libs.MultiPlatform.ktorClient)
androidLibrary(Deps.Libs.Android.lifecycle)
mppLibs.forEach { mppLibrary(it) }
}

multiplatformResources {
multiplatformResourcesPackage = "org.example.library"
}

Error Pod Install

I try install pod in ios-app directory, but console print error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
    Снимок экрана 2020-07-02 в 17 47 58

How fix it?

Style help. Navigation Bar set image, change color

Hi, i try set Navigation Bar image and color, how can i do this? Where should I put the image in folders, so that they are available in MR.images/resource.xxxx like MR.strings?
And how change button color and set round?

My screen class:
Снимок экрана 2020-06-16 в 15 07 20

My button:
Снимок экрана 2020-06-16 в 15 09 57

Screenshot_1592308787
Screenshot_20200616-150614

Cannot include additional cocoapods in podfile

I am unable to add additional Cocoapods to this project.

For instance, adding these:

kotlin {
     cocoapods {
         pod("FirebaseAuth")
         pod("GoogleSignIn")
     }
}

results in the syncMultiPlatformLibraryDebugFrameworkIosArm64 task failing. The output specifies that Kotlin Native cannot resolve the header files for these frameworks and that I must build in XCode to resolve the issue (I am building in XCode).

Building the same project with the :mpp-framework:syncFramework task works, but the application is unusable because this task doesn't bundle resources and such for moko.

Let me know if you have any possible solutions for this.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.