Any present/future pathway to embedding a `UIView`...
# compose-ios
d
Any present/future pathway to embedding a
UIView
or
CALayer
within Compose/iOS Specifically; I'm interested in having a GLSL Shaded surface within my UI, and I imagine the path of least resistance would be via native view embedding. I've seen this is possible in both Android and Compose/Desktop... being able to do this in iOS would complete the set for our App K
1
l
I wrote a prototype for this, but it had to be manually told to re-render. I couldn’t find a way to have the UIView tell me that it changed (tried overriding the draw* methods, but they were never called). I’m sure someone at JetBrains much smarter than me will figure it out once they work on platform view support.
d
We have plans to provide possibility to use Compose inside UIKit (UIView hierarchy) and SwiftUI. Another direction to use UIView inside Compose for now much harder. As for use GLSL shaders - it's impossible inside iOS apps. iOS platform may use only Metal graphics API. But, Google made Skia library. And we wrapped it in Kotlin and call it Skiko. And you may use GLSL like shaders. You may look at sample here: https://github.com/dima-avdeev-jb/skiko-mpp-shader But you should now, what Skiko library is not in stable version for now. And may break backward compatibility.
This shader written in language SKSL (Skia shader language) https://github.com/dima-avdeev-jb/skiko-mpp-shader/blob/main/src/commonMain/kotlin/org/jetbrains/skiko/sample/ShaderSample.kt And may be used inside iOS. Under the hood Skia transform it to Metal.
d
This could be ideal; thank you @Dima Avdeev 🙏