Most of the apps that we develop require a way to pick or capture a photo or video to use in the app. All social networking apps have the feature of sharing images and they ask you to upload images or videos from Camera or Photos. Similarly for other types of apps such as, chatting, and image editing apps. This kind of feature is very simple to implement in iOS and, in this section, we will see how to provide options for users to pick images.
To provide options for users to pick an image, perform the following steps:
Create a new Xcode project with the Single View Application template and name it
ImageVideoPicker
.Add a button at the center of the screen to pick a photo or video. Change the title of the button to
Pick photo / video
.Add
IBAction
to the button inViewController.swift
, like this:@IBAction func didClickOnPickButton(_ sender: AnyObject) { }
We will ask the user to choose whether to pick...