目的
ActionSheetを作る時のテンプレート
環境
- Xcode Version 11.7
- Swift 5
対応メモ
actionとaddActionを分けてる人が多いけど。
もうこだわりの域かなと。
分けた方が見易いかな!?
let alertController = UIAlertController(title: "title", message: "message", preferredStyle: UIAlertController.Style.actionSheet)
alertController.addAction(UIAlertAction(title: "default", style: .default){ _ in
print("default")
})
alertController.addAction(UIAlertAction(title: "no", style: .destructive){ _ in
print("no")
})
alertController.addAction(UIAlertAction(title: "cancel", style: .cancel){ _ in
print("cancel")
})
self.present(alertController, animated: true, completion: nil)
