my app is built with custom top bar instead of the UINavigationBar
to satisfy some requirements that cannot be done easily with the default UINavigationBar
, however, after reading the answers of this question, and changing the 3 constraints of this top bar (top, leading & trailing) to be relative to the safe area instead of the superview, I couldn't get the safe area to color itself automatically to match the color of the top bar, here is what it looks like now:
the first answer in the link above suggests to manually color the status bar but unfortunately this is unreasonable and it uses a private API to do so. and the second answer suggests to provide a background color for the main view but it's also unreasonable because I need a different color for the main view.
how can I let the unsafe area to color itself according to the nearest view which is connected to it with auto layout constraints ?