You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,19 @@
1
1
# Changelog
2
2
3
+
## [2.3.0-dev-4778-1.9.0-beta03]
4
+
5
+
- Kotlin 2.3.0-dev-4778
6
+
7
+
**Note:** This development version is required for Swift Export support until the official release of Kotlin 2.3.0.
8
+
---
9
+
3
10
## [2.2.20-RC-1.9.0-beta03]
4
11
5
12
- Kotlin 2.2.20-RC
13
+
- Adds experimental support to Swift Export
14
+
15
+
**Note:** Kotlin 2.2.20-RC has the following issues with Swift Export: [KT-80347](https://youtrack.jetbrains.com/issue/KT-80347/Swift-Export-IllegalArgumentException-Collection-contains-more-than-one-matching-element), [KT-79889](https://youtrack.jetbrains.com/issue/KT-79889/K-N-swift-export-fails-under-several-different-conditions).
16
+
Use `2.3.0-dev-4778-1.9.0-beta03` if you need Swift Export support.
Copy file name to clipboardExpand all lines: README.md
+34-17Lines changed: 34 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,17 @@
2
2
3
3
# KMP-ComposeUIViewController
4
4
5
-
KSP library for generating `ComposeUIViewController` and `UIViewControllerRepresentable`implementations when using [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/) for iOS.
5
+
KSP library and Gradle plugin for generating `ComposeUIViewController` and `UIViewControllerRepresentable`files when using [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/) for iOS.
[](https://androidweekly.net/issues/issue-583)[](https://mailchi.mp/kotlinweekly/kotlin-weekly-378)[](https://mailchi.mp/kotlinweekly/kotlin-weekly-389) <ahref="https://jetc.dev/issues/177.html"><imgsrc="https://img.shields.io/badge/As_Seen_In-jetc.dev_Newsletter_Issue_%23177-blue?logo=Jetpack+Compose&logoColor=white"alt="As Seen In - jetc.dev Newsletter Issue #177"></a> <ahref="https://jetc.dev/issues/188.html"><imgsrc="https://img.shields.io/badge/As_Seen_In-jetc.dev_Newsletter_Issue_%23188-blue?logo=Jetpack+Compose&logoColor=white"alt="As Seen In - jetc.dev Newsletter Issue #188"></a>
12
12
13
+
> [!TIP]
14
+
> For Swift Export support, until the official release of Kotlin 2.3.0, use `2.3.0-dev-4778-1.9.0-beta03`
15
+
13
16
## Motivation
14
17
As the project expands, the codebase required naturally grows, which can quickly become cumbersome and susceptible to errors. To mitigate this challenge, this library leverages [Kotlin Symbol Processing](https://kotlinlang.org/docs/ksp-overview.html) to automatically generate the necessary Kotlin and Swift code for you.
15
18
@@ -23,12 +26,12 @@ It can be used for **simple** and **advanced** use cases.
23
26
24
27
Kotlin Multiplatform and Compose Multiplatform are built upon the philosophy of incremental adoption and sharing only what you require. Consequently, the support for this specific use-case - in my opinion - is of paramount importance, especially in its capacity to entice iOS developers to embrace Compose Multiplatform.
25
28
26
-
> [!TIP]
29
+
> [!NOTE]
27
30
> This library takes care of the heavy lifting for you, but if you're interested in understanding how it works, the detailed approach is explained here: [Compose Multiplatform — Managing UI State on iOS](https://proandroiddev.com/compose-multiplatform-managing-ui-state-on-ios-45d37effeda9).
28
31
29
32
## Installation
30
33
31
-
By using the Gradle plugin all configurations will be applied automatically. If you wish to change the default values, you can configure its parameters using the available [extension](kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/ComposeUiViewControllerParameters.kt).
34
+
Configure the `plugins` block with the following three plugins. Once added, you can use the `ComposeUiViewController` block to set up the plugin’s configuration.
32
35
33
36
```kotlin
34
37
plugins {
@@ -43,6 +46,21 @@ ComposeUiViewController {
43
46
}
44
47
```
45
48
49
+
With this setup, all necessary configurations are automatically applied. You only need to adjust the `ComposeUiViewController` block to match your
50
+
project settings (e.g. `iosAppName` and `targetName`). If you wish to change the default values, you can configure its parameters:
51
+
52
+
<details><summary>Parameters available</summary>
53
+
54
+
-`iosAppFolderName` name of the folder containing the iosApp in the root's project tree;
55
+
-`iosAppName` name of the iOS project (`name.xcodeproj`);
56
+
-`targetName` name of the iOS project's target;
57
+
-`exportFolderName` name of the destination folder inside iOS project (`iosAppFolderName`) where the `UIViewControllerRepresentable` files will be copied to when `autoExport` is `true`;
58
+
-`autoExport` enables auto export generated files to Xcode project. If set to `false`, you will find the generated files under `/build/generated/ksp/`;
@@ -57,10 +75,6 @@ To annotate the parameter as the composable state variable (for **advanced** use
57
75
58
76
> [!IMPORTANT]
59
77
> Only 0 or 1 `@ComposeUIViewControllerState` and an arbitrary number of parameter types (excluding `@Composable`) are allowed in `@ComposeUIViewController` functions.
60
-
>
61
-
> The `@ComposeUIViewController` includes a `frameworkBaseName` parameter, allowing you to specify a framework name manually. While the plugin typically attempts to retrieve this name automatically, you can use this parameter to enforce a specific name <ins>if the automatic retrieval fails</ins>.
62
-
>
63
-
> For more information consult the [ProcessorTest.kt](kmp-composeuiviewcontroller-ksp/src/test/kotlin/composeuiviewcontroller/ProcessorTest.kt) file from `kmp-composeuiviewcontroller-ksp`.
> The `@ComposeUIViewController` has a `frameworkBaseName` parameter to manually set the framework name. This parameter will only be used <ins>if detection fails within the Processor</ins>.
167
+
151
168
### iOSApp
152
169
153
170
After a successful build the `UIViewControllerRepresentable` files are included and referenced in the `xcodeproj` ready to be used:
> Avoid deleting `iosApp/Representables` without first using Xcode to `Remove references`.
171
188
172
189
## Sample
173
-
For a working [sample](sample) open `iosApp/Gradient.xcodeproj` in Xcode and run standard configuration or use KMM plugin for Android Studio and choose `iosApp` in run configurations.
190
+
For a working [sample](sample) open `iosApp/Gradient.xcodeproj` in Xcode and run standard configuration or use KMP plugin for Android Studio and choose `iosApp` in run configurations.
0 commit comments