I am trying to showing a toast view on top and bottom of my view controller. However, the "Safe Area Layout" guide is neither including the navigation bar or the tab bar at the bottom. The status bar is included. I want to show the toast view below my navigation bar.
Here's my code:
guard let rootView = UIApplication.shared.windows.filter({$0.isKeyWindow}).first else {return}
let toastView = ToastView(title: title, message: message, type: type)
toastView.translatesAutoresizingMaskIntoConstraints = false
rootView.addSubview(toastView)
NSLayoutConstraint.activate([
toastView.centerXAnchor.constraint(equalTo: rootView.centerXAnchor),
toastView.leadingAnchor.constraint(greaterThanOrEqualTo: rootView.leadingAnchor, constant: 20),
toastView.topAnchor.constraint(equalTo: rootView.safeAreaLayoutGuide.topAnchor, constant: 0)
])