How to get the image picker in (swift 3) to switch back and 4th between photo gallery and camera

This code allows access to my photo gallery on the iPhone simulator in Xcode. When I put it on my iPad I can access the camera but not the photo gallery. I would like the image view to display the camera photos if choose or load a image from the photo gallery if choose.

                           import UIKit

   class ViewController:   UIViewController,   UIImagePickerControllerDelegate,            UINavigationControllerDelegate {

   let picker = UIImagePickerController()
 @IBOutlet weak var iv: UIImageView!

    @IBAction func cameraf(_ sender: UIBarButtonItem) {

if UIImagePickerController.isSourceTypeAvailable(.camera) {
    picker.allowsEditing = false
    picker.sourceType = UIImagePickerControllerSourceType.camera
    picker.cameraCaptureMode = .photo
    picker.modalPresentationStyle = .fullScreen
    present(picker,animated: true,completion: nil)
} else {
    noCamera()
}}

      @IBAction func photolibaryss(_ sender: UIBarButtonItem) {
picker.allowsEditing = false
picker.sourceType = .photoLibrary
picker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
picker.modalPresentationStyle = .popover
present(picker, animated: true, completion: nil)
picker.popoverPresentationController?.barButtonItem = sender
         }

      func noCamera(){
let alertVC = UIAlertController(
    title: "No Camera",
    message: "Sorry, this device has no camera",
    preferredStyle: .alert)
let okAction = UIAlertAction(
    title: "OK",
    style:.default,
    handler: nil)
alertVC.addAction(okAction)
present(
    alertVC,
    animated: true,
    completion: nil)
      }
     override func viewDidLoad() {
        super.viewDidLoad()
              picker.delegate = self
              }
               func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info:           [String : AnyObject])
         {
        var  chosenImage = UIImage()
        chosenImage = info[UIImagePickerControllerOriginalImage] as! UIImage
           iv.contentMode = .scaleAspectFit
         iv.image = chosenImage
             dismiss(animated:true, completion: nil)
       }
        func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
               dismiss(animated: true, completion: nil)
        }
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
             // Dispose of any resources that can be recreated.
              }}