Chapter 15. Overlay UI

At this point we have a fully tested and working overlay manager and model. It’s time to make use of them! We are going to be adding an editing view controller that will allow us to select which overlay we want (if any) on our selfie. This view controller will sit after our capture view controller and will be automatically presented after taking a photo.

Note

Our editing view is intentionally simple. We could add in all sorts of additional features, such as different overlays, touchups, cropping, color changes, and so on, but as these all take a rather long time to make, and wouldn’t teach you anything new beyond how to manipulate and draw image data, we are going to just stick with our eyebrow overlays.

Building the UI

Without further ado, let’s get started on building the UI:

  1. Open Main.storyboard and drag in a new view controller.

  2. Create a manual segue from the capture view controller to the new view controller:

    1. Select the capture view controller from the scene.

    2. Control-drag from the capture view controller to the new view controller.

    3. From the segue menu that appears, select the Show option.

Tip

All of our segues to date have been automatic segues that are triggered by actions. A manual segue works identically to an automatic segue, but instead of being fired due to an action in the UI, you trigger it yourself in the code. This means you don’t have to hide a button somewhere in your UI just to get a segue. We’ll be calling our manual segue ...

Get Learning Swift, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.