diff --git a/Targeting iOS and Android with Kotlin Multiplatform/03_CreatingSharedCode.md b/Targeting iOS and Android with Kotlin Multiplatform/03_CreatingSharedCode.md index 7880e74..0acd6c0 100644 --- a/Targeting iOS and Android with Kotlin Multiplatform/03_CreatingSharedCode.md +++ b/Targeting iOS and Android with Kotlin Multiplatform/03_CreatingSharedCode.md @@ -8,6 +8,7 @@ We will create several new files in our project to implement this. ## Updating Gradle Scripts The `SharedCode` sub-project should generate several artifacts for us: + - A JAR file for the Android project, from the `androidMain` source set - The Apple framework - for iOS device and App Store (`arm64` target) diff --git a/Targeting iOS and Android with Kotlin Multiplatform/04_UsingSharedCodeAndroid.md b/Targeting iOS and Android with Kotlin Multiplatform/04_UsingSharedCodeAndroid.md index e944608..83ac903 100644 --- a/Targeting iOS and Android with Kotlin Multiplatform/04_UsingSharedCodeAndroid.md +++ b/Targeting iOS and Android with Kotlin Multiplatform/04_UsingSharedCodeAndroid.md @@ -20,7 +20,8 @@ Let's patch the (the name may be different if we changed it in the new project wizard). Select the _Text_ tab at the bottom of the preview to switch it to XML and add several more attributes to the `` element: -``` + +```xml android:id="@+id/main_text" android:textSize="42sp" android:layout_margin="5sp" @@ -30,7 +31,7 @@ and add several more attributes to the `` element: Next, let's add the following line of code to the end of the `onCreate` method from the `MainActivity` class in the `/app/src/main/java/com/jetbrains/handson/mpp/mobile/MainActivity.kt` file, : -``` +```kotlin findViewById(R.id.main_text).text = createApplicationScreenMessage() ``` @@ -38,6 +39,7 @@ You will need to add the import for the `android.widget.TextView` class. Android will automatically suggest adding the import. Depending on the Android application package, we may also need to add the import for the `createApplicationScreenMessage()` function too. We should see these two lines at the beginning of the `MainActivity.kt` file: + ```kotlin import com.jetbrains.handson.mpp.mobile.createApplicationScreenMessage import android.widget.TextView diff --git a/Targeting iOS and Android with Kotlin Multiplatform/06_SettingUpKotlinFramework.md b/Targeting iOS and Android with Kotlin Multiplatform/06_SettingUpKotlinFramework.md index 8273370..be336e0 100644 --- a/Targeting iOS and Android with Kotlin Multiplatform/06_SettingUpKotlinFramework.md +++ b/Targeting iOS and Android with Kotlin Multiplatform/06_SettingUpKotlinFramework.md @@ -6,9 +6,10 @@ from console. This task is designed to help to simplify the setup of our iOS Fra in the Xcode project model. We need several binaries from the framework to use it with Xcode: -- `iOS arm64 debug` --- the binary to run the iOS device in debug mode -- `iOS arm64 release` --- the binary to include into a release version of an app -- `iOS x64 debug` --- the binary for iOS simulator, which uses the desktop mac CPU + +- `iOS arm64 debug` to run on the iOS device in debug mode +- `iOS arm64 release` to include into a release version of an app +- `iOS x64 debug` for the iOS Simulator, which uses the desktop Mac CPU The easiest way to configure Xcode to use a custom-built framework is to place the framework under the same folder for all configurations and targets. @@ -30,6 +31,7 @@ To do this we can double-click on the `KotlinIOS` node (or root node) of the *pr to open the *target* settings. Next we then click on the `+` in the *Embedded Binaries* section, click *Add Other...* button in the dialog to choose the framework from the disk. We can then point to the following folder: + ``` SharedCode/build/xcode-frameworks/SharedCode.framework ``` diff --git a/Targeting iOS and Android with Kotlin Multiplatform/07_Summary.md b/Targeting iOS and Android with Kotlin Multiplatform/07_Summary.md index 2749edf..c972cec 100644 --- a/Targeting iOS and Android with Kotlin Multiplatform/07_Summary.md +++ b/Targeting iOS and Android with Kotlin Multiplatform/07_Summary.md @@ -1,14 +1,15 @@ # Summary In the tutorial we: + - Created an Android application in Android Studio - Created an iOS application in Xcode - - Added Kotlin multiplatform sub-project + - Added Kotlin multiplatform sub-project - with shared Kotlin code - compiled it to Android Jar - compiled it to iOS Framework - Put it all together and re-used Kotlin code - + We can find all the sources from that tutorial at [GitHub](https://github.com/JetBrains/kotlin-examples/tree/master/tutorials/mpp-iOS-Android). # Next Steps