I have the simplest setup in Kotlin with org.jetbrains.compose v 1.4.0
fun MainViewController() =
ComposeUIViewController {
Button(onClick = { }) {
Text("Click me")
}
}
On iOS i have:
struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
MainIosKt.MainViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
struct ContentView: View {
@State var showSettings = false
var body: some View {
VStack {
ZStack {
Rectangle()
.fill(.red)
.frame(width: 500, height: 500)
ComposeView()
.padding(EdgeInsets(top: 140, leading: 140, bottom: 140, trailing: 140))
}
}
}
}
There is a white background obscuring the red rectangle even if not set specifically. I would like to have transparent background so that I can overlay compose UI over other iOS content like camera feed.
Tried to:
- change compose theme background & surface
- change ComposeView modalPresentationStyle to .currentContext or .overCurrentContext
- change ComposeView vc.view.backgroundColor = UIColor.clear
But the white background is still present. Is that not supported for now or am I doing something wrong?