Obj-C Version:
[[searchBackView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:0] setActive:YES];
If you have translucent columns, note: then topLayoutGuide is below the column, for example, statusBar.
see: topLayoutGuide. Explains conditions that are important to consider.
Whereas safeAreaLayoutGuide.topAnchor will not be below NivationBars; much easier to work with.
Wayne
source share