Hi, I'm implementing SwiftUI views into compose wi...
# compose-ios
a
Hi, I'm implementing SwiftUI views into compose with the UIKitViewController but at this point we need to implement a fixed width and height. Is there a way that the width and height is dynamic?
r
As far as I am aware of, only with callbacks, so compose after layouting tells swiftui its height and then you set that as fixed value.
a
Okay and any idea how I should do that?
c
@John O'Reilly Didn't you have a blog post and code sample on how to do this?
r
You could use the
Copy code
onGloballyPositioned
modifier to get the size, then report it back via lambda and set it within SwiftUI. I don't like this approach, that's why I try to avoid these cases.
j
>@John O'Reilly Didn't you have a blog post and code sample on how to do this?
Not sure it's exactly what's being asked here (or still necessarily best approach) but did write about that here https://johnoreilly.dev/posts/swiftui-component-compose-ios/
👍🏽 1
👍 1
a
I will have a look into that! Thanks