I want to dismiss alert message when tap out side the alertController in swift language.

Thank's advance
You need to add the tap gesture in your view in the viewDidLoad like this way
let tapGesture:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.viewTapped(_:)))
self.view.addGestureRecognizer(tapGesture)
Now add this viewTapped in your ViewController
func viewTapped(sender: UITapGestureRecognizer){
self.dismissViewControllerAnimated(true, completion: nil)
}