Put simply, I want to get the bounds of this blue rectangle using Swift code:
The coordinates of this rectangle are visible in the Size inspector:
In an empty App project in Xcode, I've tried using view.safeAreaLayoutGuide.layoutFrame
to get the CGRect, but this property seems to contain the bounds of the entire view, not the safe area. Specifically, it returns 0.0
, 0.0
, 896.0
and 414.0
for minX
, minY
, width
and height
respectively.
I've also tried to get the top
, bottom
, left
and right
properties of view.safeAreaInsets
, but this returns 0 for each of them.
I've also tried to get the view.superview
in case there was another view on top, but it returned nil
.
All these values come from the iPhone 11. I'm using Xcode 12.