Taking Pictures and UIImagePickerController

In the choosePhotoSource(_:) method, you will instantiate a UIImagePickerController and present it on the screen. When creating an instance of UIImagePickerController, you must set its sourceType property and assign it a delegate. Because there is set-up work needed for the image picker controller, you need to create and present it programmatically instead of through the storyboard.

Creating a UIImagePickerController

Close the editor showing Main.storyboard. In DetailViewController.swift, add a new method that creates and configures a UIImagePickerController instance. You will need to create the UIImagePickerController instance from more than one place, so abstracting it into a method ...

Get iOS Programming: The Big Nerd Ranch Guide, 7th 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.