I am trying to host a compose view inside of SwiftUI as a part of my UI (I don't want it to take up the whole screen). But when I tried using the composable inside my layout, it expands to fill its parent. I want its size to match the content.
I think the problem I ran into was how to preserve the intrinsic size of the composable during the conversion to a UIViewController.
My workaround so far is to somehow figure out the size of the composable on the compose side of things and then setting the preferedContentSize of the UIViewController to that (in Kotlin). Then I use the fixedSize() view modifier in SwiftUI to make it only take up as much space as needed.
Is there a better way to make the UIViewControllerRepresentable's size match the size of the composable it's representing?