Reputation: 12336
If you have something like
something = bottomLayoutGuide.length
nowadays you just get a warning
'bottomLayoutGuide' was deprecated in iOS 11.0: Use view.safeAreaLayoutGuide
.bottomAnchor instead of bottomLayoutGuide.topAnchor
I do not have a clue how to do this. I just don't have the slightest clue how to get a value out of .safeAreaLayoutGuide
Figured I better give up and ask here after trying about 20 things.
Upvotes: 1
Views: 376
Reputation: 5212
Top and Bottom Layout Guide
were a part of the current UIViewController. On iOS 11, they were replaced by SafeLayoutGuide
, which is a part of the UIViewController's root view.
From the Apple's Documentation:
When the view is visible onscreen, this guide reflects the portion of the view that is not covered by navigation bars, tab bars, toolbars, and other ancestor views. (In tvOS, the safe area reflects the area not covered the screen's bezel.) If the view is not currently installed in a view hierarchy, or is not yet visible onscreen, the layout guide edges are equal to the edges of the view.
You need to get it from the safeAreaInsets property of SafeLayoutGuide
So, instead of this:
something = bottomLayoutGuide.length
You can use this:
something = view.safeAreaInsets.bottom
Upvotes: 3