How to set edgesForExtendedLayout to none in Swift 3
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
In Swift 3, edgesForExtendedLayout is an option set that controls whether a view controller’s root view extends underneath bars such as the navigation bar or tab bar. If you want the equivalent of "none," the correct Swift syntax is an empty option set, written as [].
The Swift 3 Syntax You Actually Need
The normal fix looks like this:
That line tells UIKit not to extend the controller’s root view under any edges. Developers often search for something like .none, but this API is not an enum. It is an option set, so the empty collection syntax is the right way to mean "no edges."
If you only want some edges, you can specify them explicitly:
But for the common "do not extend under bars" case, [] is the direct answer.
What the Property Changes
UIKit may extend a view underneath translucent bars to create a more immersive layout. That can be desirable for full-screen visuals, but it can also cause ordinary content to appear underneath the navigation bar or status area.
Setting edgesForExtendedLayout = [] is a controller-level way to say that the root view should stop at the visible content area instead of extending behind those bars.
This was especially common in older UIKit layouts where:
- navigation bars were translucent
- constraints were pinned to the controller’s main view instead of a safe area
- scroll view inset behavior was less automatic than modern code expects
For those older layouts, the property often solved "my content starts under the navigation bar" immediately.
Why It Was Common in Swift 3 Code
Swift 3 sits in an era where many codebases still relied heavily on controller-wide layout properties instead of safe-area-first layout design. If a label, table view, or custom container appeared hidden behind the top bar, developers often reached for edgesForExtendedLayout = [] because it changed the entire layout behavior in one line.
That approach is valid for maintaining existing UIKit code, especially when the screen design really should start below the bars. It is also easy to explain and easy to test.
However, it is important to understand what it is doing. It does not fix arbitrary Auto Layout mistakes. It changes whether UIKit allows the root view to extend into the bar areas.
Modern Layout Context: Safe Areas
Even though the title is about Swift 3, the broader UIKit direction is worth knowing. In newer code, safe-area constraints are often a better long-term solution than globally disabling extended layout.
A safe-area-aware constraint looks like this:
This approach makes the specific view respect visible content boundaries without changing the controller’s overall layout behavior. That is often a cleaner design when only part of the screen needs protection from bars.
So the practical advice is:
- use
edgesForExtendedLayout = []when you are maintaining older controller-wide layout behavior - prefer safe-area-driven constraints when designing newer layouts
Common Pitfalls
The biggest mistake is looking for a .none member and assuming the API changed or is broken when it does not exist. In Swift 3, [] is the correct representation of no selected edges.
Another issue is using this property as a universal fix for all bar-related layout problems. Sometimes the real problem is poor constraints, scroll-view inset handling, or bar translucency settings.
Developers also sometimes forget that this is a controller-wide behavior. If only one subview needs a layout adjustment, safe-area constraints may be more precise than disabling extended layout for the entire screen.
Finally, if a scroll view is involved, remember that content inset behavior and bar translucency can still matter even after setting edgesForExtendedLayout = [].
Summary
- In Swift 3, the equivalent of "none" for
edgesForExtendedLayoutis[]. - The property controls whether the root view extends under navigation or tab bars.
- '
edgesForExtendedLayout = []was a common UIKit-era fix for content appearing under translucent bars.' - It changes controller-wide layout behavior, not just one constraint.
- For newer layouts, safe-area constraints are often a better long-term approach.

