💬 A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code.

Overview

AlertController

💬 A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code.

Alert

let alert = UIAlertController.alert()
alert.setTitle("✅ Success", color: .darkGreen)
alert.setMessage("Your message has been sent")
alert.addAction(
    title: "Send more",
    systemIcon: "envelope.fill",
    color: .darkGreen,
    leftAligment: true
) {}
alert.addAction(
    title: "Delete message",
    systemIcon: "trash.fill",
    color: .red,
    leftAligment: true
) {}
alert.addOkAction()
present(alert, animated: true)

Sheet

let sheet = UIAlertController.sheet("👨🏻 Mezhevikin Alexey")
sheet.addAction(
    title: "Edit profile",
    systemIcon: "person.fill",
    color: .darkGreen,
    leftAligment: true
) {}
sheet.addAction(
    title: "Delete account",
    systemIcon: "trash.fill",
    color: .red,
    leftAligment: true
) {}
sheet.addAction(
    title: "Log out",
    systemIcon: "square.and.arrow.down.fill",
    leftAligment: true
) {}
sheet.addCancelAction()
present(sheet, sourceView: cell)

Choice

let sheet = UIAlertController.sheet("Choose your favorite animal")
let animals = ["🐈 Cat", "🐕 Dog", "🐎 Horse", "🐫 Camel"]
for (i, animal) in animals.enumerated() {
    sheet.addAction(
        title: animal,
        checked: favoriteAnimal == i,
        leftAligment: true
    ) {
        self.favoriteAnimal = i
    }
 }
sheet.addCancelAction()
present(sheet, sourceView: cell)

TextField

let alert = UIAlertController.alert("🔓 Login")
alert.addTextField {
    $0.placeholder = "✉️ Mail"
}
alert.addTextField {
    $0.placeholder = "🔑 Password"
    $0.isSecureTextEntry = true
}
alert.addAction(title: "OK") {
    if let mail = alert.textFields?[0].text,
        let password = alert.textFields?[0].text
    {
        print("✉️ \(mail), 🔑 \(password)")    
    }
}
present(alert)

Present

// Alert
present(alert)
// Sheet from cell with iPad support
present(sheet, sourceView: cell) 
// Sheet from BarButton with iPad support
present(sheet, barButtonItem: navigationItem.leftBarButtonItem) 

Swift Package Manager

https://github.com/mezhevikin/AlertController.git
You might also like...
PMAlertController is a great and customizable alert that can substitute UIAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.
A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

PMAlertController is a great and customizable alert that can substitute UIAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

This is an iOS control for selecting a date using UIDatePicker in an UIAlertController like manner
This is an iOS control for selecting a date using UIDatePicker in an UIAlertController like manner

RMDateSelectionViewController This framework allows you to select a date by presenting an action sheet. In addition, it allows you to add actions arro

This is an iOS control for presenting any UIView in an UIAlertController like manner
This is an iOS control for presenting any UIView in an UIAlertController like manner

RMActionController This framework allows you to present just any view as an action sheet. In addition, it allows you to add actions around the present

This is an iOS control for selecting something using UIPickerView in an UIAlertController like manner
This is an iOS control for selecting something using UIPickerView in an UIAlertController like manner

RMPickerViewController This framework allows you to pick something with a picker presented as an action sheet. In addition, it allows you to add actio

An easy to use UIAlertController builder for swift

LKAlertController An easy to use UIAlertController builder for swift Features Short and simple syntax for creating both Alerts and ActionSheets from U

Customizable replacement for UIAlertController

ActionSheet Customizable replacement for UIAlertController. Requirements Installation Swift Package Manager The Swift Package Manager is a tool for au

UIAlertController with continuity.

CuckooAlert Allow multiple use of presentViewController to UIAlertController. You may be disappointed from this. Do you imagine that cuckoo spit out s

Owner
Mezhevikin Alexey
Mobile developer. Created getconverter.org and examenpdd.com. I write in Swift and Kotlin
Mezhevikin Alexey
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...

Alerts & Pickers Advanced usage of native UIAlertController with TextField, TextView, DatePicker, PickerView, TableView, CollectionView and MapView. F

RV 5.5k Dec 26, 2022
Simple UIAlertController builder class in Swift.

Kamagari Simple UIAlertController builder class in Swift. Features AlertBuilder class to simply build UIAlertController by using method chaining UIAle

Kazunobu Tasaka 78 Nov 29, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
Simple Alert View written in Swift, which can be used as a UIAlertController. (AlertController/AlertView/ActionSheet)

DOAlertController Simple Alert View written in Swift, which can be used as a UIAlertController replacement. It supports from iOS7! It is simple and ea

Daiki Okumura 406 Sep 5, 2022
A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

donggyu 5 Jan 26, 2022
Simple and elegant way to handle UIAlertController.

SwiftyAlert SwiftAlert is simple and elegant way to handle UIAlertController. Feature Handle action with async/await Method chain Support UITextField

Jaesung Jung 2 Oct 30, 2022
A Glyphs plugin that draws colored lines to indicate the presence of zero-width glyphs.

Show Zero-Width Glyphs This is a plugin for the Glyphs font editor that draws colored lines to indicate the presence of zero-width glyphs in Edit View

Florian Pircher 1 Apr 26, 2022
Swifty, modern UIAlertController wrapper.

Alertift Alertift.alert(title: "Alertift", message: "Alertift is swifty, modern, and awesome UIAlertController wrapper.") .action(.default("❤️"))

Suguru Kishimoto 287 Jan 7, 2023
An easier constructor for UIAlertController. Present an alert from anywhere.

ALRT An easier constructor for UIAlertController. Present an alert from anywhere like this. ALRT.create(.alert, title: "Alert?").addOK().addCancel().s

Masahiro Watanabe 97 Nov 11, 2022
Easy Swift UIAlertController

EZAlertController Easy Swift UIAlertController One line setup for all UIAlertControllers Button action with closures instead of selectors Easily custo

Kan Yilmaz 366 Sep 14, 2022