---
title: "#310: Screen Edges in iOS 11 📲"
url: https://littlebitesofcocoa.com/310-screen-edges-in-ios-11
author: Jake Marsh
published: 2017-06-08
topics: ["UIKit"]
description: "Continuing our look at the new tidbits and goodies from WWDC 2017, today we'll learn about the changes to screen edge behavior in iOS 11."
---

# #310: Screen Edges in iOS 11 📲

By Jake Marsh, June 8, 2017. HTML: https://littlebitesofcocoa.com/310-screen-edges-in-ios-11

Continuing our look at the new tidbits and goodies from **WWDC 2017**, today we'll learn about the changes to screen edge behavior in **iOS 11**. Let's dive in.

What we're really talking about here is the behavior when a user drags from offscreen. This could be the user trying to pull down **Notification Center** from the top, or bring up **Control Center** from the bottom of the screen.

In past **iOS** releases, the system has looked at the visibility of the **status bar** to determine how to behave in these cases.

If we configured one of our **view controllers** to <i>hide</i> the **status bar**, the system would show a little "tab" UI with an arrow that the user would need to drag a second time before **Notification Center** or **Control Center** would be shown:

<img src="https://media.littlebitesofcocoa.com/310-1.png" style="width: 64px;" />

Keying off of the visibility of the **status bar** probably isn't the best way for us to "tell" the system what to do here.

In **iOS 11**, we've been given a wonderful new way to describe how our app should behave when the user performs these gestures.

Now, all we need to do is override this **function** in our **view controlller**:

``` swift
override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
  return .bottom
}
```

This way, we can describe <i>exactly</i> which edges of the screen we'd like to allow the system gestures to behave "normally", and which we'd like to have defer for a second drag. Neat!

Finally, if the state of our **view controller** ever changes enough to warrant a change in this behavior, we can call the following new function to update it:

``` swift
setNeedsUpdateOfScreenEdgesDeferringSystemGestures()
```

<p></p>
