Browse Source

fix typo ChatViewController (#2768)

pull/2786/head
dima.avdeev 1 year ago committed by GitHub
parent
commit
9e8a138a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      experimental/examples/chat-mpp/README.md
  2. 2
      experimental/examples/chat-mpp/iosApp/iosApp/ComposeViewControllerToSwiftUI.swift
  3. 2
      experimental/examples/chat-mpp/shared/src/iosMain/kotlin/main.ios.kt

10
experimental/examples/chat-mpp/README.md

@ -1,5 +1,10 @@
# Chat example app # Chat example app
## SwiftUI interop
This example shows how you can set up an interop between SwiftUI and Compose.
Pay attention to the file [ComposeViewControllerToSwiftUI.swift](iosApp%2FiosApp%2FComposeViewControllerToSwiftUI.swift).
This file helps to add Compose inside SwiftUI hierarchy.
Example can run on Android, iOS, desktop or in a browser. Example can run on Android, iOS, desktop or in a browser.
*Prerequisites*: to run on iOS and Android, you should have "Kotlin Multiplatform Mobile" plugin installed either *Prerequisites*: to run on iOS and Android, you should have "Kotlin Multiplatform Mobile" plugin installed either
@ -29,8 +34,3 @@ Then choose **iosApp** configuration in IDE and run it.
### Run MacOS via Gradle: ### Run MacOS via Gradle:
- on Intel CPU: `./gradlew :shared:runDebugExecutableMacosX64` - on Intel CPU: `./gradlew :shared:runDebugExecutableMacosX64`
- on Apple Silicon: `./gradlew :shared:runDebugExecutableMacosArm64` - on Apple Silicon: `./gradlew :shared:runDebugExecutableMacosArm64`
## SwiftUI interop
This example shows how you can set up an interop between SwiftUI and Compose.
Pay attention to the file [ComposeViewControllerToSwiftUI.swift](iosApp%2FiosApp%2FComposeViewControllerToSwiftUI.swift).
This file help to add Compose inside SwiftUI hierarchy.

2
experimental/examples/chat-mpp/iosApp/iosApp/ComposeViewControllerToSwiftUI.swift

@ -4,7 +4,7 @@ import shared
struct ComposeViewControllerToSwiftUI: UIViewControllerRepresentable { struct ComposeViewControllerToSwiftUI: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController { func makeUIViewController(context: Context) -> UIViewController {
return Main_iosKt.ChapViewController() return Main_iosKt.ChatViewController()
} }
func updateUIViewController(_ uiViewController: UIViewController, context: Context) { func updateUIViewController(_ uiViewController: UIViewController, context: Context) {

2
experimental/examples/chat-mpp/shared/src/iosMain/kotlin/main.ios.kt

@ -1,7 +1,7 @@
import androidx.compose.ui.window.Application import androidx.compose.ui.window.Application
import platform.UIKit.UIViewController import platform.UIKit.UIViewController
fun ChapViewController(): UIViewController = fun ChatViewController(): UIViewController =
Application("Chat") { Application("Chat") {
ChatApp(displayTextField = false) ChatApp(displayTextField = false)
} }

Loading…
Cancel
Save