https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
a

Andrew Watson

11/30/2023, 8:18 PM
I'm just curious about this; has anyone tried embedding SwiftUI inside Compose Multiplatform? Curious if it works any sort of well
j

Joel Denke

11/30/2023, 8:28 PM
Yes but very clumpsy syntax compared to Android view equivalent. It works but feels uhm unnatural
a

Andrew Watson

11/30/2023, 8:29 PM
Thanks for the response. How is the performance? I guess what I'm thinking about is if I want to do a full in-place replacement of a compose multiplatform screen with a swift UI one
Use Compose Multiplatform for most screens, SwiftUI when needed
I recommend ditch Swift ui as much as possible. I strive for zero Swift code myself. Performance depends what you doing. I havent tested large scale and only testing in iOS simulator. I dont own an iPhone 😁
a

Andrew Watson

11/30/2023, 8:31 PM
Fair enough!
j

Joel Denke

11/30/2023, 8:32 PM
From my experience swiftui never needed if go compose multiplatform. More to interact with iOS SDKs and objc uikit components but sparely.
But also I am not an iOS expert. So wouldnt take my advice that heavy weight.
c

curioustechizen

12/01/2023, 4:59 AM
There is a presentation (I think it was from KotlinConf) that demonstrated when you would need to embed a SwiftUI View inside a Composable and how to do it. Typical examples are platform-specific things like CameraView, MapView, Video players, WebView etc. Of course you could also do this by embedding a UIKitView but it is likely that there us a SwiftUI wrapper for the platform native functionality already.
a

Andrew Watson

12/01/2023, 5:08 AM
If you can find that presentation I'd love to see it. I want to make sure doing that doesn't cause any odd performance issues
c

curioustechizen

12/01/2023, 5:10 AM

https://www.youtube.com/watch?v=FWVi4aV36d8

k

Kashismails

12/01/2023, 8:54 AM
i tried it for text field but using a interface that is then implemented by a uiview, the uiview is then used inside compose multiplatform. Its not not good
5 Views