How can we detect the size and changes of the iPhone 14 pro dynamic-island?
Since the safe area provides a safe rectangle inside the rounded screen and top or bottom insets, but nothing about an object inside the rectangle.
How can we detect the size and changes of the iPhone 14 pro dynamic-island?
Since the safe area provides a safe rectangle inside the rounded screen and top or bottom insets, but nothing about an object inside the rectangle.
2
Answers
You can simply try to get the safe area top insets and use the dynamic height as you want.
In my scenario, requirement was to change status bar background colour. So I did something like this:
Dynamic island is fun to play with. screen shot
First of all for most developers it is sufficient to use
safeArea
as we did before, because dynamic island does not cover it (if not in expanded state). There are currently 3 states of fynamic island:You can check each state if you use dynamic island yourself as part WidgetKit. Create a new widget extension if your app doesn’t already include one. Live Activities use WidgetKit functionality and SwiftUI for their user interface. For creating new Activities, please refer to Apple official documentation for Displaying live data with Live Activities.
If you are not intending to use Activities, but want to somehow be aware of dynamic island available sizes, Apple provides as with Dynamic island size sheet included in Live Activities documentation :
Here is an attachment of how safeArea looks implemented with dynamic island: