How to get a place for my custom vertical bar?

If i'm going to implement a custom vertical bar – how do i arrange for that? Any good doc / instruction?

Answered by Frameworks Engineer in 906530022

In addition to the vertical edge trait/environment value, you can use the UIView.LayoutRegion.bar(onEdge:extent:) layout region along with methods like UIView.layoutGuide(for:) to position a custom bar in UIKit. In SwiftUI, you can use the safeAreaBar modifier.

If you are implementing custom tab and toolbar, keep in mind that the position of the bar can change depending on certain system heuristics.

For the tab bar in particular, it will expand to display labels during a long press, and the system also displays the Large Content Viewer with the symbol and label when the user has set their text size to use accessibility sizes, starting with Accessibility Medium.

People using iOS are accustomed to these default behaviors on tab bars and toolbars, which make apps more accessible. As you implement your custom bars, please do not forget to introduce these behaviors as well. To learn more, watch the WWDC19 video Large Content Viewer - Ensuring Readability for Everyone.

The edge of the vertical bar can be read from the environment's toolbarVerticalEdge in SwiftUI, and verticalBarEdge in the trait collection in UIKit.

Accepted Answer

In addition to the vertical edge trait/environment value, you can use the UIView.LayoutRegion.bar(onEdge:extent:) layout region along with methods like UIView.layoutGuide(for:) to position a custom bar in UIKit. In SwiftUI, you can use the safeAreaBar modifier.

@Frameworks Engineer @Technology Evangelist 💛 thank you both!

Can't exactly pick one answer – so, market the latest as confirmation/addition to the first one.

Yes. It also confirms – i'd better not do it. However, if I still opt to do it – good to know the starting points!

How to get a place for my custom vertical bar?
 
 
Q