Is enabling Safe Area Layout Guides compatible to iOS below 11?
Simple Swift 4 Solution:
First set to top constraint priority to the safe area to 750, then:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if #available(iOS 11, *) {
// Safe area constraints already set.
} else {
NSLayoutConstraint.activate([
self.yourView.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor)
])
}
}