Hi all, I’m trying to integrate WindowInsets on iO...
# compose-ios
b
Hi all, I’m trying to integrate WindowInsets on iOS in order to correctly draw behind notch, dynamic island, etc. I have connected it to iOS
safeAreaInsets
and that works fine. But the problem I have is that when screen is rotated this insets change. As per iOS documentation that change should trigger,
UIViewController.viewSafeAreaInsetsDidChange
, but in kotlin that is an extension function, an therefore I can’t override it. Does anyone know what is that and how I can work around this?
t
You can check out https://github.com/Tlaster/SafeArea as an example.
b
Thanks for the link. Looking at it I see there is just a 'remember' block around it. Which should work, but if possible I would like to avoid it, since there is an actual callbacks for when the value is changed.
d
Soon we will start to implement an "insets" solution for iOS too.
b
Great to hear. I'm happy to share my implementation if it helps. It has most of the implementation done, together with ime insets. With the exception of the issue mentioned above.
d
Yes, it may be helpful. Do you have it in Open Source ?
b
Yes. It's a fork of compose-multiplatform-core. I'll push the branch tomorrow and share it here.
d
You may not hurry
b
Here you go Branch containing compose core changes: https://github.com/blazsolar/androidx/tree/feature/iosWindowInsets Branch with todo-lite app integration: https://github.com/blazsolar/compose-jb/tree/feature/iosWindowInsets Also a screen recording demonstrating changes. As mentioned above, work is not 100% ready, there are still some edge cases to handle.
d
@Vladimir Mazunin it may be interesting for you
a
@Blaž if I may ask, were there any hiccups you had getting the support repo working on mac? This ain’t my first rodeo with AOSP, but I never really use frameworks/support outside of AOSP! 😅
b
Nothing except updating the agp and gradle version. And even that just because I was on a canary android studio.
a
If you use their studiow tool, it'll download the specific version of Android Studio into the directory, it's another one of those AOSP tools... I was getting classpath issues if I installed prebuilts, if I didn't use prebuilts, building wouldn't work as it looks for prebuilts.
158 Views