Skip to content

Instantly share code, notes, and snippets.

View davut's full-sized avatar

Davut Jepbarov davut

View GitHub Profile
let alertController = UIAlertController(title: "Hello!", message: "Wazzup?", preferredStyle: .alert)
let action = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
func myAlertVC() {
let alertController = UIAlertController(title: "Hello!", message: "Wazzup?", preferredStyle: .alert)
let action = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
func myAlertVC(title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
class MyAlertController {
func showAlert(on vc: UIViewController, withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
vc.present(alertController, animated: true, completion: nil)
}
}
class ViewController: UIViewController {
let myAlertController = MyAlertController()
...
override func viewDidLoad() {
super.viewDidLoad()
myAlertController.showAlert(on: self, withTitle: "Hello", message: "Wazzup", actionTitle: "OK!")
}
class MyAlertController {
func showAlert(on vc: UIViewController, withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(..)
let action = UIAlertAction(...)
alertController.addAction(action)
vc.present(alertController, animated: true, completion: nil)
}
func showErrorMessage(on vc: UIViewController) {
extension UIViewController {
func showAlert(withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
}
extension UIViewController {
func showAlert(withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
func showHeyAlert() {
showAlert(withTitle: "Hey", message: "HeyHey", actionTitle: "OK")
}
extension UIViewController {
func showAlert(withTitle title: String, message: String, actionTitle: String = "OK") {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
func showHeyAlert() {
// Customizable actionTitle
showAlert(withTitle: "Hey", message: "HeyHey", actionTitle: "Hey Hey Yo")
@davut
davut / allturkmenwords.json
Created January 31, 2022 06:07
Enedilim.com day ähli türkmen sözler
{
"words": [
"a",
"aba",
"abadan",
"abadanlaşmak",
"abadanlyk",
"abadançylyk",
"abanmak",
"abanyşmak",