In case this is of interest....would love to hear ...
# compose-ios
j
In case this is of interest....would love to hear any feedback on approach used https://twitter.com/joreilly/status/1655289995094106112?s=20
👍 2
👍🏻 1
a
First, you can use
onSizeChanged
instead of
onGloballyPositioned
. The former is called less often. Second, if I understand it correctly, your UI requires a second frame to settle down, which is bad both UX-wise and performance-wise. IMO just migrating the whole screen to compose is much better.
j
Hmm, I had initially tried onSizeChanged but that didn't seem to work
Also don't have strong opinion on whether this is generally good approach....just exploring possibilities right now
But I do agree from what I've seen so far that sharing a whole screen does seem to make more sense.
t
How about skipping SwiftUI in this case and do pure UIKit? In my existing app, since I have not put in too much SwiftUI (and what was done was painful), I am leaning towards only using Compose for iOS as embedded UIViewController within other UIViewControllers, keeping all navigation pure UIKit and using RxSwift for any state management...
I have been disappointed at how SwiftUI is tied to iOS releases, so if they fix a bug in one version you need, you rare forced to update. Whereas Compose works back to API 21, which is quite nice.
j
I've generally been trying this with existing projects that are already using SwiftUI
a
This is definitely not a good approach and I would say it's better to make that clear in your post, and ideally also include the drawbacks.
j
the post was very much phrased as an exploration and not a recommendation "This is work in progress and still some open questions but writing this article to capture what I’ve tried so far (will update if/when there are better approaches for doing anything shown here)."
I've seen examples elsewhere, including talk at KotlinConf, of sharing Compose based UI components like this within existing SwiftUI screen......when you say "this is definitely not a good approach" do you mean in general when doing this or specifically when including in ScrollView as per my post where that measurement stuff is needed?
t
I would definitely never say definitely, but as mentioned I would expect it to be a valid architecture and any issues worked out where they may be found. Perhaps there needs to be a UIView wrapper like there is a UIViewController wrapper that is perhaps smarter about taking part in a ScrollView / UITableView / UICollectionView...
a
The latter. I've explained that in my second point. See also this thread.