//Define this in your button action. @IBAction func profileBtnAct( _ sender: Any ) { //Create the AlertController and add Its action like button in Actionsheet let actionSheetControllerIOS8: UIAlertController = UIAlertController (title: "Select Image" , message: nil , preferredStyle: . actionSheet ) let cancelActionButton = UIAlertAction (title: "Camera" , style: . default ) { _ in print ( "Camera" ) self . openCamera () } actionSheetControllerIOS8. addAction (cancelActionButton) let saveActionButton = UIAlertAction (title: "Gallery" , style: . default ) { _ in ...