UIAlertController生成
let alert = UIAlertController(title: "アラートのタイトル", message: "アラートのメッセージ", preferredStyle: UIAlertControllerStyle.alert)
アラートにテキスト入力フォームを追加
alert.addTextField(configurationHandler: nil)
アラートにボタンを追加
let okButton = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction!) in
//ボタンを押した時の処理
})
alert.addAction(okButton)
アラートを閉じるキャンセルボタン
let cancelButton = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)
alert.addAction(cancelButton)
アラートを表示
self.present(alert, animated: true, completion: nil)