https://kotlinlang.org logo
Title
b

Blaž

04/17/2023, 1:39 PM
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

Tlaster

04/17/2023, 3:11 PM
You can check out https://github.com/Tlaster/SafeArea as an example.
b

Blaž

04/17/2023, 3:54 PM
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

Dima Avdeev

04/17/2023, 5:46 PM
Soon we will start to implement an "insets" solution for iOS too.
b

Blaž

04/17/2023, 6:29 PM
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

Dima Avdeev

04/17/2023, 7:32 PM
Yes, it may be helpful. Do you have it in Open Source ?
b

Blaž

04/17/2023, 7:42 PM
Yes. It's a fork of compose-multiplatform-core. I'll push the branch tomorrow and share it here.
d

Dima Avdeev

04/17/2023, 7:45 PM
You may not hurry
b

Blaž

04/18/2023, 9:44 AM
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

Dima Avdeev

04/19/2023, 5:07 PM
@Vladimir Mazunin it may be interesting for you
a

andrew

04/30/2023, 4:13 AM
@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

Blaž

04/30/2023, 7:14 AM
Nothing except updating the agp and gradle version. And even that just because I was on a canary android studio.
a

andrew

04/30/2023, 3:45 PM
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.