├── .gitignore ├── LICENSE ├── README.md ├── android ├── build.gradle ├── gradle.properties └── mobile │ ├── build.gradle │ ├── deploy_crashlytics.sh │ ├── google-services.json │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── marcinmoskala │ │ └── mkpexample │ │ └── QuotationsActivity.kt │ └── res │ ├── drawable │ ├── launcher_circle_icon.png │ └── launcher_icon.png │ ├── layout │ └── activity_quotations.xml │ └── values │ └── strings.xml ├── build.gradle ├── common-js └── build.gradle ├── common-jvm └── build.gradle ├── common-native └── build.gradle ├── common ├── build.gradle └── src │ ├── main │ └── kotlin │ │ └── com │ │ └── marcinmoskala │ │ ├── data │ │ └── Quote.kt │ │ ├── presentation │ │ └── QuotationPresenter.kt │ │ ├── repository │ │ ├── QuotationRepository.kt │ │ └── QuotationRepositoryImpl.kt │ │ └── view │ │ └── QuotationView.kt │ └── test │ └── kotlin │ └── com │ └── marcinmoskala │ └── QuotePresenterUnitTest.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── ios-classic ├── ExampleMKP.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── marcin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── marcin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── ExampleMKP │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── ios.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── marcin.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcschemes │ │ └── xcschememanagement.plist └── xcuserdata │ └── marcin.xcuserdatad │ └── xcschemes │ ├── ios.xcscheme │ └── xcschememanagement.plist ├── ios ├── .idea │ ├── codeStyles │ │ └── Project.xml │ ├── misc.xml │ ├── modules.xml │ ├── workspace.xml │ └── xcode.xml ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── ios.xcodeproj │ └── xcuserdata │ │ └── marcin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── src │ └── main │ └── kotlin │ ├── AppDelegate.kt │ ├── ViewController.kt │ └── main.kt ├── settings.gradle ├── web-vanilla ├── build.gradle ├── css │ └── style.css └── main.html └── web ├── build.gradle └── src └── main ├── kotlin └── com │ └── marcinmoskala │ ├── components │ └── QuotesComponent.kt │ └── main.kt └── web ├── css └── style.css └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .gradle 3 | .idea/* 4 | out 5 | *.iml 6 | .directory 7 | node_modules 8 | local.properties 9 | /backend/static/* 10 | keystore.jks 11 | android/mobile/release/* 12 | 13 | .DS_Store 14 | .externalNativeBuild 15 | .database 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Start 2 | 3 | # Known problems 4 | 5 | You might see: 6 | Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6. 7 | 8 | Also: 9 | Error:The modules ['android', 'mobile'] point to the same directory in the file system. 10 | Each module must have a unique path. 11 | 12 | # Hacks 13 | 14 | Multiplatform development in Kotlin still have some limitations. 15 | This is why I had to apply some hacks which are temporary. 16 | 17 | ## Native dependencies 18 | 19 | Cannot declare Gradle dependencies on Konan yet, so we just include sources. 20 | 21 | https://youtrack.jetbrains.net/issue/KT-25582 22 | 23 | ## Names generated by JS 24 | 25 | Generated names for functions have mashed names. This is why from: 26 | ``` 27 | interface QuotationView { 28 | fun showQuote(quote: Quote) 29 | } 30 | ``` 31 | 32 | We have function required named `showQuote_4z1tej$` 33 | 34 | https://youtrack.jetbrains.net/issue/KT-25583 35 | 36 | ## Mixing Kotlin and Swift dependencies is not allowed in Konan 37 | 38 | We cannot do: 39 | ``` 40 | class ViewController : UIViewController, QuotationView { 41 | 42 | override fun showQuote(quote: Quote) { 43 | textView.text = quote.text 44 | authorView.text = quote.person 45 | } 46 | 47 | //... 48 | } 49 | ``` 50 | 51 | We need to do instead: 52 | ``` 53 | class ViewController : UIViewController { 54 | 55 | private val quotationView = object : QuotationView { 56 | override fun showQuote(quote: Quote) { 57 | textView.text = quote.text 58 | authorView.text = quote.person 59 | } 60 | } 61 | 62 | // ... 63 | } 64 | ``` -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'https://maven.google.com' } 4 | jcenter() 5 | google() 6 | mavenCentral() 7 | maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" } 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.1.3' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | maven { url 'https://maven.google.com' } 18 | maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" } 19 | jcenter() 20 | } 21 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.configureondemand=false -------------------------------------------------------------------------------- /android/mobile/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 27 7 | buildToolsVersion "27.0.3" 8 | defaultConfig { 9 | applicationId "org.kotlinacademy.android" 10 | minSdkVersion 18 11 | targetSdkVersion 27 12 | versionCode 13 13 | versionName "1.1.1" 14 | multiDexEnabled true 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | debug {} 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | ext.betaDistributionReleaseNotesFilePath = "crashlytics_release_notes.txt" 23 | ext.betaDistributionGroupAliases = "android-testers" 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation project(':common-jvm') 30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 31 | implementation 'com.android.support:appcompat-v7:27.1.1' 32 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 33 | } -------------------------------------------------------------------------------- /android/mobile/deploy_crashlytics.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RELEASE_NOTES="`git log --oneline -1`" 4 | 5 | echo "$RELEASE_NOTES" > crashlytics_release_notes.txt 6 | 7 | ./gradlew :android:mobile:crashlyticsUploadDistributionProdDebug 8 | -------------------------------------------------------------------------------- /android/mobile/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1091715558873", 4 | "firebase_url": "https://kotlinacademy-d9d13.firebaseio.com", 5 | "project_id": "kotlinacademy-d9d13", 6 | "storage_bucket": "kotlinacademy-d9d13.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:1091715558873:android:5a9be25b5204dbf5", 12 | "android_client_info": { 13 | "package_name": "org.kotlinacademy.android" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "1091715558873-vtcva31umnli0vkagq7idvnvb8jjj2pu.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "org.kotlinacademy.android", 22 | "certificate_hash": "b14802083fcb564515737ab7da4242aede14e724" 23 | } 24 | }, 25 | { 26 | "client_id": "1091715558873-fjru2ahin89hop1j0ur9frd4t4c7r838.apps.googleusercontent.com", 27 | "client_type": 1, 28 | "android_info": { 29 | "package_name": "org.kotlinacademy.android", 30 | "certificate_hash": "061e967beb23f607f9ac581f4fc61bdfe99a53a1" 31 | } 32 | }, 33 | { 34 | "client_id": "1091715558873-si02csudnuqjuib2lv8qfe6gmmafshgp.apps.googleusercontent.com", 35 | "client_type": 3 36 | } 37 | ], 38 | "api_key": [ 39 | { 40 | "current_key": "AIzaSyB4UnmW58pO3BHXdfGgtoMFw-Y4ybMSngI" 41 | } 42 | ], 43 | "services": { 44 | "analytics_service": { 45 | "status": 1 46 | }, 47 | "appinvite_service": { 48 | "status": 2, 49 | "other_platform_oauth_client": [ 50 | { 51 | "client_id": "1091715558873-si02csudnuqjuib2lv8qfe6gmmafshgp.apps.googleusercontent.com", 52 | "client_type": 3 53 | } 54 | ] 55 | }, 56 | "ads_service": { 57 | "status": 2 58 | } 59 | } 60 | } 61 | ], 62 | "configuration_version": "1" 63 | } -------------------------------------------------------------------------------- /android/mobile/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/mobile/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /android/mobile/src/main/java/com/marcinmoskala/mkpexample/QuotationsActivity.kt: -------------------------------------------------------------------------------- 1 | package com.marcinmoskala.mkpexample 2 | 3 | import android.app.Activity 4 | import android.os.Bundle 5 | import kotlinx.android.synthetic.main.activity_quotations.* 6 | import com.marcinmoskala.data.Quote 7 | import com.marcinmoskala.presentation.QuotationPresenter 8 | import com.marcinmoskala.repository.QuotationRepositoryImpl 9 | import com.marcinmoskala.view.QuotationView 10 | 11 | class QuotationsActivity : Activity(), QuotationView { 12 | 13 | private val quotationsRepo = QuotationRepositoryImpl() 14 | private val presenter = QuotationPresenter(this, quotationsRepo) 15 | 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | setContentView(R.layout.activity_quotations) 19 | presenter.onStart() 20 | nextButton.setOnClickListener { presenter.onNext() } 21 | } 22 | 23 | override fun showQuote(quote: Quote) { 24 | textView.text = quote.text 25 | authorView.text = quote.person 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /android/mobile/src/main/res/drawable/launcher_circle_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcinMoskala/KotlinMultiplatformExample/57b5bca1560442d55eb64c6fb0d6a15d25c01c1c/android/mobile/src/main/res/drawable/launcher_circle_icon.png -------------------------------------------------------------------------------- /android/mobile/src/main/res/drawable/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcinMoskala/KotlinMultiplatformExample/57b5bca1560442d55eb64c6fb0d6a15d25c01c1c/android/mobile/src/main/res/drawable/launcher_icon.png -------------------------------------------------------------------------------- /android/mobile/src/main/res/layout/activity_quotations.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 23 | 30 | 38 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /ios-classic/ExampleMKP/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios-classic/ExampleMKP/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ExampleMKP 4 | // 5 | // Created by Marcin Moskala on 16.07.2018. 6 | // Copyright © 2018 Marcin Moskala. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import QuotationsCommon 11 | 12 | class ViewController: UIViewController, QuotationView { 13 | 14 | @IBOutlet weak var textView: UILabel! 15 | @IBOutlet weak var authorView: UILabel! 16 | 17 | let repo = QuotationRepositoryImpl() 18 | var presenter: QuotationPresenter! 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | presenter = QuotationPresenter(view: self, repo: repo) 23 | presenter.onStart() 24 | } 25 | 26 | @IBAction func onNext() { 27 | presenter.onNext() 28 | } 29 | 30 | func showQuote(quote: Quote) { 31 | textView.text = quote.text 32 | authorView.text = quote.person 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ios.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BF8C70E7EE00D229A40E19D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF8C7D8AC208FCB2DC607237 /* Main.storyboard */; }; 11 | BF8C797C3AA8EBAA46BCA2D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF8C706392DE3976E583CC5B /* Assets.xcassets */; }; 12 | BF8C7AB971E0FF80ADE26585 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF8C7B5222E2A40A9B2A4972 /* LaunchScreen.storyboard */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | BF8C70146B1CC6F85D1D0C2F /* gradle-wrapper.properties */ = {isa = PBXFileReference; lastKnownFileType = file.properties; path = "gradle-wrapper.properties"; sourceTree = ""; }; 17 | BF8C703E8AB1486AC0F23A76 /* ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ios.app; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | BF8C706392DE3976E583CC5B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 19 | BF8C70F6FB4A1F07E4C476C6 /* ViewController.kt */ = {isa = PBXFileReference; lastKnownFileType = file.kt; path = ViewController.kt; sourceTree = ""; }; 20 | BF8C718AF68360C05910D094 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 21 | BF8C723DB0EFE9C5C51B7465 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 22 | BF8C749A5528D2A6DBBEA0BA /* main.kt */ = {isa = PBXFileReference; lastKnownFileType = file.kt; path = main.kt; sourceTree = ""; }; 23 | BF8C79A29EF7273CBF895B91 /* AppDelegate.kt */ = {isa = PBXFileReference; lastKnownFileType = file.kt; path = AppDelegate.kt; sourceTree = ""; }; 24 | BF8C79ABFB20F5FAEC2ADD10 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.info; path = Info.plist; sourceTree = ""; }; 25 | BF8C7B2F324154C633B9E8A1 /* gradlew */ = {isa = PBXFileReference; lastKnownFileType = text; path = gradlew; sourceTree = ""; }; 26 | BF8C7CB0BDC64C28B17D699B /* gradle-wrapper.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = "gradle-wrapper.jar"; sourceTree = ""; }; 27 | BF8C7D455A40B02D78B92827 /* build.gradle */ = {isa = PBXFileReference; lastKnownFileType = file.gradle; path = build.gradle; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | BF8C7F822F5A7454C856C489 /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | BF8C719FA6F4E1CFDAA8F2EF /* src */ = { 42 | isa = PBXGroup; 43 | children = ( 44 | BF8C7C18433FC674F77ACE8A /* main */, 45 | ); 46 | path = src; 47 | sourceTree = ""; 48 | }; 49 | BF8C71A4B828D6A0E0F69DA3 /* wrapper */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | BF8C70146B1CC6F85D1D0C2F /* gradle-wrapper.properties */, 53 | BF8C7CB0BDC64C28B17D699B /* gradle-wrapper.jar */, 54 | ); 55 | path = wrapper; 56 | sourceTree = ""; 57 | }; 58 | BF8C71F1640D3FAB983F3012 /* ios */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | BF8C79FE532F814D0ADBC059 /* Supporting Files */, 62 | BF8C79ABFB20F5FAEC2ADD10 /* Info.plist */, 63 | BF8C706392DE3976E583CC5B /* Assets.xcassets */, 64 | BF8C7B5222E2A40A9B2A4972 /* LaunchScreen.storyboard */, 65 | BF8C7D8AC208FCB2DC607237 /* Main.storyboard */, 66 | BF8C719FA6F4E1CFDAA8F2EF /* src */, 67 | ); 68 | path = ios; 69 | sourceTree = ""; 70 | }; 71 | BF8C74017254DD9B9848AC0F = { 72 | isa = PBXGroup; 73 | children = ( 74 | BF8C7EF03D690DC75F316E9D /* Products */, 75 | BF8C71F1640D3FAB983F3012 /* ios */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | BF8C791A58BC5B8D6EEDF390 /* gradle */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | BF8C71A4B828D6A0E0F69DA3 /* wrapper */, 83 | ); 84 | path = gradle; 85 | sourceTree = ""; 86 | }; 87 | BF8C79FE532F814D0ADBC059 /* Supporting Files */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | BF8C7D455A40B02D78B92827 /* build.gradle */, 91 | BF8C7B2F324154C633B9E8A1 /* gradlew */, 92 | BF8C791A58BC5B8D6EEDF390 /* gradle */, 93 | ); 94 | name = "Supporting Files"; 95 | sourceTree = ""; 96 | }; 97 | BF8C7C18433FC674F77ACE8A /* main */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | BF8C7DB6341A367379D4621F /* kotlin */, 101 | ); 102 | path = main; 103 | sourceTree = ""; 104 | }; 105 | BF8C7DB6341A367379D4621F /* kotlin */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | BF8C79A29EF7273CBF895B91 /* AppDelegate.kt */, 109 | BF8C70F6FB4A1F07E4C476C6 /* ViewController.kt */, 110 | BF8C749A5528D2A6DBBEA0BA /* main.kt */, 111 | ); 112 | path = kotlin; 113 | sourceTree = ""; 114 | }; 115 | BF8C7EF03D690DC75F316E9D /* Products */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | BF8C703E8AB1486AC0F23A76 /* ios.app */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | /* End PBXGroup section */ 124 | 125 | /* Begin PBXNativeTarget section */ 126 | BF8C702E582C23B81D669071 /* ios */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = BF8C79DC568A7203438EDF3C /* Build configuration list for PBXNativeTarget "ios" */; 129 | buildPhases = ( 130 | BF8C7365EBBA87493221AFB0 /* Sources */, 131 | BF8C7F822F5A7454C856C489 /* Frameworks */, 132 | BF8C766FCEDBCD72D6D3157E /* Resources */, 133 | BF8C75B05285D2310B7EEDD7 /* Compile Kotlin/Native */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = ios; 140 | productName = ios; 141 | productReference = BF8C703E8AB1486AC0F23A76 /* ios.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | BF8C71DB81C67BFBF8F95703 /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | ORGANIZATIONNAME = marcinmoskala; 151 | }; 152 | buildConfigurationList = BF8C75CA5EE40A6CF1AB0028 /* Build configuration list for PBXProject "ios" */; 153 | compatibilityVersion = "Xcode 3.2"; 154 | developmentRegion = English; 155 | hasScannedForEncodings = 0; 156 | knownRegions = ( 157 | en, 158 | ); 159 | mainGroup = BF8C74017254DD9B9848AC0F; 160 | productRefGroup = BF8C7EF03D690DC75F316E9D /* Products */; 161 | projectDirPath = ""; 162 | projectRoot = ""; 163 | targets = ( 164 | BF8C702E582C23B81D669071 /* ios */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | BF8C766FCEDBCD72D6D3157E /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | BF8C797C3AA8EBAA46BCA2D1 /* Assets.xcassets in Resources */, 175 | BF8C7AB971E0FF80ADE26585 /* LaunchScreen.storyboard in Resources */, 176 | BF8C70E7EE00D229A40E19D4 /* Main.storyboard in Resources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXResourcesBuildPhase section */ 181 | 182 | /* Begin PBXShellScriptBuildPhase section */ 183 | BF8C75B05285D2310B7EEDD7 /* Compile Kotlin/Native */ = { 184 | isa = PBXShellScriptBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | ); 188 | inputPaths = ( 189 | ); 190 | name = "Compile Kotlin/Native"; 191 | outputPaths = ( 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | shellPath = /bin/sh; 195 | shellScript = "rm -f \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\"\ncd \"$SRCROOT/$KONAN_PACKAGE_NAME\"; sh -c \". ./gradlew $KONAN_TASK -Pkonan.configuration.build.dir=\\\"$CONFIGURATION_BUILD_DIR\\\" \\\n-Pkonan.debugging.symbols=$DEBUGGING_SYMBOLS -Pkonan.optimizations.enable=$KONAN_ENABLE_OPTIMIZATIONS\"\ncp \"$TARGET_BUILD_DIR/$KONAN_PACKAGE_NAME.kexe\" \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\""; 196 | }; 197 | /* End PBXShellScriptBuildPhase section */ 198 | 199 | /* Begin PBXSourcesBuildPhase section */ 200 | BF8C7365EBBA87493221AFB0 /* Sources */ = { 201 | isa = PBXSourcesBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin PBXVariantGroup section */ 210 | BF8C7B5222E2A40A9B2A4972 /* LaunchScreen.storyboard */ = { 211 | isa = PBXVariantGroup; 212 | children = ( 213 | BF8C723DB0EFE9C5C51B7465 /* Base */, 214 | ); 215 | name = LaunchScreen.storyboard; 216 | sourceTree = ""; 217 | }; 218 | BF8C7D8AC208FCB2DC607237 /* Main.storyboard */ = { 219 | isa = PBXVariantGroup; 220 | children = ( 221 | BF8C718AF68360C05910D094 /* Base */, 222 | ); 223 | name = Main.storyboard; 224 | sourceTree = ""; 225 | }; 226 | /* End PBXVariantGroup section */ 227 | 228 | /* Begin XCBuildConfiguration section */ 229 | BF8C71E419EFCACEF5BA5658 /* Release */ = { 230 | isa = XCBuildConfiguration; 231 | buildSettings = { 232 | ALWAYS_SEARCH_USER_PATHS = NO; 233 | CLANG_ANALYZER_NONNULL = YES; 234 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 235 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 236 | CLANG_CXX_LIBRARY = "libc++"; 237 | CLANG_ENABLE_MODULES = YES; 238 | CLANG_ENABLE_OBJC_ARC = YES; 239 | CLANG_ENABLE_OBJC_WEAK = YES; 240 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 241 | CLANG_WARN_BOOL_CONVERSION = YES; 242 | CLANG_WARN_COMMA = YES; 243 | CLANG_WARN_CONSTANT_CONVERSION = YES; 244 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 245 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 246 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN_ENUM_CONVERSION = YES; 249 | CLANG_WARN_INFINITE_RECURSION = YES; 250 | CLANG_WARN_INT_CONVERSION = YES; 251 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 252 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 253 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 255 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 256 | CLANG_WARN_STRICT_PROTOTYPES = YES; 257 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 258 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | CODE_SIGN_IDENTITY = "iPhone Developer"; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 264 | ENABLE_NS_ASSERTIONS = NO; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu11; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 270 | GCC_WARN_UNDECLARED_SELECTOR = YES; 271 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 272 | GCC_WARN_UNUSED_FUNCTION = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 275 | MTL_ENABLE_DEBUG_INFO = NO; 276 | SDKROOT = iphoneos; 277 | VALIDATE_PRODUCT = YES; 278 | }; 279 | name = Release; 280 | }; 281 | BF8C7356204ADAF2F05CC375 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 285 | INFOPLIST_FILE = ios/Info.plist; 286 | KONAN_ENABLE_OPTIMIZATIONS = NO; 287 | KONAN_PACKAGE_NAME = ios; 288 | "KONAN_TASK[sdk=iphoneos*]" = "compileKonan$(TARGET_NAME:c99extidentifier)Ios_arm64"; 289 | "KONAN_TASK[sdk=iphonesimulator*]" = "compileKonan$(TARGET_NAME:c99extidentifier)Ios_x64"; 290 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 291 | PRODUCT_BUNDLE_IDENTIFIER = com.marcinmoskala.ios; 292 | PRODUCT_NAME = "$(TARGET_NAME)"; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | VALID_ARCHS = arm64; 295 | }; 296 | name = Debug; 297 | }; 298 | BF8C74F64823C7D1922C8DE7 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 302 | INFOPLIST_FILE = ios/Info.plist; 303 | KONAN_ENABLE_OPTIMIZATIONS = YES; 304 | KONAN_PACKAGE_NAME = ios; 305 | "KONAN_TASK[sdk=iphoneos*]" = "compileKonan$(TARGET_NAME:c99extidentifier)Ios_arm64"; 306 | "KONAN_TASK[sdk=iphonesimulator*]" = "compileKonan$(TARGET_NAME:c99extidentifier)Ios_x64"; 307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 308 | PRODUCT_BUNDLE_IDENTIFIER = com.marcinmoskala.ios; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | VALID_ARCHS = arm64; 312 | }; 313 | name = Release; 314 | }; 315 | BF8C757E22822BEB0DF35906 /* Debug */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_ANALYZER_NONNULL = YES; 320 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_ENABLE_OBJC_WEAK = YES; 326 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 327 | CLANG_WARN_BOOL_CONVERSION = YES; 328 | CLANG_WARN_COMMA = YES; 329 | CLANG_WARN_CONSTANT_CONVERSION = YES; 330 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 332 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INFINITE_RECURSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 342 | CLANG_WARN_STRICT_PROTOTYPES = YES; 343 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 344 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | CODE_SIGN_IDENTITY = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = dwarf; 350 | ENABLE_STRICT_OBJC_MSGSEND = YES; 351 | ENABLE_TESTABILITY = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu11; 353 | GCC_DYNAMIC_NO_PIC = NO; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_OPTIMIZATION_LEVEL = 0; 356 | GCC_PREPROCESSOR_DEFINITIONS = ( 357 | "DEBUG=1", 358 | "$(inherited)", 359 | ); 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 367 | MTL_ENABLE_DEBUG_INFO = YES; 368 | ONLY_ACTIVE_ARCH = YES; 369 | SDKROOT = iphoneos; 370 | }; 371 | name = Debug; 372 | }; 373 | /* End XCBuildConfiguration section */ 374 | 375 | /* Begin XCConfigurationList section */ 376 | BF8C75CA5EE40A6CF1AB0028 /* Build configuration list for PBXProject "ios" */ = { 377 | isa = XCConfigurationList; 378 | buildConfigurations = ( 379 | BF8C757E22822BEB0DF35906 /* Debug */, 380 | BF8C71E419EFCACEF5BA5658 /* Release */, 381 | ); 382 | defaultConfigurationIsVisible = 0; 383 | defaultConfigurationName = Release; 384 | }; 385 | BF8C79DC568A7203438EDF3C /* Build configuration list for PBXNativeTarget "ios" */ = { 386 | isa = XCConfigurationList; 387 | buildConfigurations = ( 388 | BF8C7356204ADAF2F05CC375 /* Debug */, 389 | BF8C74F64823C7D1922C8DE7 /* Release */, 390 | ); 391 | defaultConfigurationIsVisible = 0; 392 | }; 393 | /* End XCConfigurationList section */ 394 | }; 395 | rootObject = BF8C71DB81C67BFBF8F95703 /* Project object */; 396 | } 397 | -------------------------------------------------------------------------------- /ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios.xcodeproj/project.xcworkspace/xcuserdata/marcin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcinMoskala/KotlinMultiplatformExample/57b5bca1560442d55eb64c6fb0d6a15d25c01c1c/ios.xcodeproj/project.xcworkspace/xcuserdata/marcin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ios.xcodeproj/project.xcworkspace/xcuserdata/marcin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ios.xcodeproj/xcuserdata/marcin.xcuserdatad/xcschemes/ios.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 29 | 30 | 31 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ios.xcodeproj/xcuserdata/marcin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ios.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | iOS.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ios/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ios/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /ios/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | true 27 | DEFINITION_ORDER 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 1531862748761 146 | 151 | 152 | 153 | 154 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 184 | 185 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /ios/.idea/xcode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ios/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /ios/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/build.gradle: -------------------------------------------------------------------------------- 1 | // ios/build.gradle 2 | apply plugin: 'konan' 3 | 4 | konan.targets = [ 5 | 'ios_arm64', 'ios_x64' 6 | ] 7 | 8 | konanArtifacts { 9 | program('ios') { 10 | srcFiles fileTree('src/main/kotlin') 11 | enableDebug true 12 | libraries { 13 | allLibrariesFrom project(':common-native') 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /ios/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcinMoskala/KotlinMultiplatformExample/57b5bca1560442d55eb64c6fb0d6a15d25c01c1c/ios/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ios/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip -------------------------------------------------------------------------------- /ios/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /ios/ios.xcodeproj/xcuserdata/marcin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ios.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ios/src/main/kotlin/AppDelegate.kt: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.kt 3 | // ios 4 | // 5 | // Created by Marcin Moskala on 17.07.2018. 6 | // Copyright © 2018 marcinmoskala. All rights reserved. 7 | // 8 | 9 | import kotlinx.cinterop.* 10 | import platform.UIKit.* 11 | 12 | class AppDelegate : UIResponder(), UIApplicationDelegateProtocol { 13 | companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta {} 14 | 15 | override fun init() = initBy(AppDelegate()) 16 | 17 | private var _window: UIWindow? = null 18 | override fun window() = _window 19 | override fun setWindow(window: UIWindow?) { _window = window } 20 | } -------------------------------------------------------------------------------- /ios/src/main/kotlin/ViewController.kt: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.kt 3 | // ios 4 | // 5 | // Created by Marcin Moskala on 17.07.2018. 6 | // Copyright © 2018 marcinmoskala. All rights reserved. 7 | // 8 | 9 | import kotlinx.cinterop.* 10 | import platform.Foundation.* 11 | import platform.UIKit.* 12 | import com.marcinmoskala.data.Quote 13 | import com.marcinmoskala.presentation.QuotationPresenter 14 | import com.marcinmoskala.repository.QuotationRepositoryImpl 15 | import com.marcinmoskala.view.QuotationView 16 | 17 | @ExportObjCClass 18 | class ViewController : UIViewController { 19 | 20 | constructor(aDecoder: NSCoder): super(aDecoder) 21 | override fun initWithCoder(aDecoder: NSCoder) = initBy(ViewController(aDecoder)) 22 | 23 | @ObjCOutlet lateinit var textView: UILabel 24 | @ObjCOutlet lateinit var authorView: UILabel 25 | 26 | private val quotationView = object : QuotationView { 27 | override fun showQuote(quote: Quote) { 28 | textView.text = quote.text 29 | authorView.text = quote.person 30 | } 31 | } 32 | private val quotationsRepo = QuotationRepositoryImpl() 33 | private val presenter = QuotationPresenter(quotationView, quotationsRepo) 34 | 35 | override fun viewDidLoad() { 36 | presenter.onStart() 37 | } 38 | 39 | @ObjCAction 40 | fun onNext() { 41 | presenter.onNext() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ios/src/main/kotlin/main.kt: -------------------------------------------------------------------------------- 1 | // 2 | // main.kt 3 | // ios 4 | // 5 | // Created by Marcin Moskala on 17.07.2018. 6 | // Copyright © 2018 marcinmoskala. All rights reserved. 7 | // 8 | 9 | import kotlinx.cinterop.* 10 | import platform.Foundation.* 11 | import platform.UIKit.* 12 | 13 | fun main(args: Array) { 14 | memScoped { 15 | val argc = args.size + 1 16 | val argv = (arrayOf("konan") + args).map { it.cstr.getPointer(memScope) }.toCValues() 17 | 18 | autoreleasepool { 19 | UIApplicationMain(argc, argv, null, NSStringFromClass(AppDelegate)) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'web' 2 | include 'android' 3 | include 'android:mobile' 4 | include 'common' 5 | include 'common-js' 6 | include 'common-jvm' 7 | include 'common-native' 8 | include 'web-vanilla' -------------------------------------------------------------------------------- /web-vanilla/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'kotlin-platform-js' 2 | 3 | dependencies { 4 | expectedBy project(':common') 5 | compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" 6 | testCompile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" 7 | testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" 8 | testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" 9 | testCompile "io.mockk:mockk-js:$mockk_version" 10 | } 11 | 12 | compileKotlin2Js { 13 | kotlinOptions.moduleKind = 'plain' 14 | } 15 | 16 | task assembleWeb(type: Sync) { 17 | configurations.compile.each { file -> 18 | from(zipTree(file.absolutePath), { 19 | includeEmptyDirs = false 20 | include { fileTreeElement -> 21 | def path = fileTreeElement.path 22 | path.endsWith(".js") && (path.startsWith("META-INF/resources/") || 23 | !path.startsWith("META-INF/")) 24 | } 25 | }) 26 | } 27 | from compileKotlin2Js.destinationDir 28 | into "${projectDir}/build/web" 29 | 30 | dependsOn classes 31 | } 32 | 33 | assemble.dependsOn assembleWeb -------------------------------------------------------------------------------- /web-vanilla/css/style.css: -------------------------------------------------------------------------------- 1 | .center { 2 | position: absolute; 3 | top: 50%; 4 | left: 50%; 5 | transform: translate(-50%, -50%); 6 | } 7 | 8 | .person { 9 | text-align: right; 10 | } 11 | 12 | .quotation-container { 13 | text-align: center; 14 | } 15 | 16 | .text { 17 | font-weight: 600; 18 | font-family: "Open Sans", open-sans, sans-serif; 19 | font-size: 28px; 20 | } -------------------------------------------------------------------------------- /web-vanilla/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Quotations 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 | 17 | 18 | 19 | 31 | -------------------------------------------------------------------------------- /web/build.gradle: -------------------------------------------------------------------------------- 1 | group "org.kotlinacademy" 2 | version "1.1" 3 | 4 | apply plugin: 'org.jetbrains.kotlin.frontend' 5 | apply plugin: 'kotlin2js' 6 | 7 | kotlinFrontend { 8 | downloadNodeJsVersion = '10.0.0' 9 | 10 | npm { 11 | dependency("webpack-cli", "v2.0.12") 12 | dependency("firebase", "^4.6.2") 13 | dependency("react", "15.6.1") 14 | dependency("react-dom", "15.6.1") 15 | dependency("react-router-dom", "4.2.2") 16 | dependency("@material-ui/core", "1.1.0") 17 | } 18 | 19 | sourceMaps = true 20 | 21 | webpackBundle { 22 | bundleName = "main" 23 | contentPath = file('src/main/web') 24 | proxyUrl = "http://localhost:8080" 25 | } 26 | } 27 | 28 | dependencies { 29 | compile project(':common-js') 30 | compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" 31 | compile("org.jetbrains.kotlinx:kotlinx-html-js:0.6.11") { force = true } 32 | compile "org.jetbrains:kotlin-react:16.4.1-pre.34-kotlin-1.2.50" 33 | compile "org.jetbrains:kotlin-react-dom:16.4.1-pre.34-kotlin-1.2.50" 34 | } 35 | 36 | compileKotlin2Js { 37 | kotlinOptions.metaInfo = true 38 | kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" 39 | kotlinOptions.sourceMap = true 40 | kotlinOptions.moduleKind = 'commonjs' 41 | kotlinOptions.main = "call" 42 | } -------------------------------------------------------------------------------- /web/src/main/kotlin/com/marcinmoskala/components/QuotesComponent.kt: -------------------------------------------------------------------------------- 1 | package com.marcinmoskala.components 2 | 3 | import com.marcinmoskala.data.* 4 | import com.marcinmoskala.presentation.* 5 | import com.marcinmoskala.repository.* 6 | import com.marcinmoskala.view.* 7 | import kotlinx.html.js.* 8 | import react.* 9 | import react.dom.* 10 | 11 | class QuotesComponent : RComponent(), QuotationView { 12 | 13 | private val repo = QuotationRepositoryImpl() 14 | private val presenter = QuotationPresenter(this, repo) 15 | 16 | override fun componentDidMount() { 17 | presenter.onStart() 18 | } 19 | 20 | override fun RBuilder.render() { 21 | div(classes = "center") { 22 | val quote = state.quote 23 | if (quote == null) { 24 | +"No quote yet" 25 | } else { 26 | div(classes = "quotation-container") { 27 | div(classes = "text") { +quote.text } 28 | div(classes = "person") { +quote.person } 29 | button(classes = "next") { 30 | +"Next" 31 | attrs { onClickFunction = { presenter.onNext() } } 32 | } 33 | } 34 | } 35 | } 36 | } 37 | 38 | override fun showQuote(quote: Quote) { 39 | setState { this.quote = quote } 40 | } 41 | } 42 | 43 | external interface ManagerComponentState : RState { 44 | var quote: Quote? 45 | } -------------------------------------------------------------------------------- /web/src/main/kotlin/com/marcinmoskala/main.kt: -------------------------------------------------------------------------------- 1 | package com.marcinmoskala 2 | 3 | import com.marcinmoskala.components.QuotesComponent 4 | import react.dom.render 5 | import kotlin.browser.document 6 | import kotlin.browser.window 7 | 8 | fun main(args: Array) { 9 | window.onload = { 10 | render(document.getElementById("root")!!) { 11 | child(QuotesComponent::class) {} 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /web/src/main/web/css/style.css: -------------------------------------------------------------------------------- 1 | .center { 2 | position: absolute; 3 | top: 50%; 4 | left: 50%; 5 | transform: translate(-50%, -50%); 6 | } 7 | 8 | .person { 9 | text-align: right; 10 | } 11 | 12 | .quotation-container { 13 | text-align: center; 14 | } 15 | 16 | .text { 17 | font-weight: 600; 18 | font-family: "Open Sans", open-sans, sans-serif; 19 | font-size: 28px; 20 | } -------------------------------------------------------------------------------- /web/src/main/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Quotations 6 | 7 | 8 | 9 | 10 |
11 | 12 | --------------------------------------------------------------------------------