From the course: Machine Learning for iOS Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implement an image picker controller

Implement an image picker controller - iOS Tutorial

From the course: Machine Learning for iOS Developers

Start my 1-month free trial

Implement an image picker controller

- [Instructor] Our first task is going to make it possible for our users to actually tap on this image view to bring out an image picker controller and select a photo from the Photo Library. And since this is a very privacy-related feature, what you have to do in the info.plist is to specify a reason why you'd like to access the user's Photo Library. And I have already done this so in the info.plist file, I have added the key, Privacy Photo Library Usage Description. And my usage description is a little bit funny, so I am saying, you want to make sure a dog is really a dog, don't you. So if you're shipping your application then, maybe this should be a little bit more purposeful. But having said that, let's go into our view controller and add the necessary code to actually display an image picker controller. And in my selectImageSource function in line 26 in the ViewController.swift file, what I'd like to do is just create an imagePicker object. And we can just initialize that with…

Contents