Swifty, modern UIAlertController wrapper.

Overview

Alertift

logo

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

GitHub release Language Carthage Compatible CocoaPods CocoaPodsDL

Feature

  • Method chain.
  • Can add multiple actions at once.
  • UITextField support.
  • Image support. (above v3.1)
  • iPad support(Action Sheet, popover).
  • Can change title/message/button text/ background color without using private APIs.
  • Can change title/message's alignment without using private APIs.

How to use

👉 👉 👉 How to use

Requirements

  • iOS 9.0+
  • Xcode 10+
  • Swift 5.0+

Installation

Carthage

  • Add the following to your Cartfile:
github "sgr-ksmt/Alertift" ~> 4.2
  • Run carthage update
  • Add the framework as described.
    Details: Carthage Readme

CocoaPods

Alertift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Alertift', '~> 4.2'

and run pod install

Swift PM

use version 4.2.0 or higher.

Manually Install

Download all *.swift files and put your project.

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request. 💪

License

Alertift is under MIT license. See the LICENSE file for more info.

Comments
  • No Issue but Code Further optimization

    No Issue but Code Further optimization

    First of all well done a very good and complete written wrapper for UIAlert Controller. So my point is that when a user call action sheet on iPhone or iPad so your code should automattically set popover if device is a iPad so there is no need of user decision.

    opened by imran87 5
  • Does not work on Swift 4.2

    Does not work on Swift 4.2

    Some minor APIs were renamed in Swift 4.2, current version does not compile/run on latest Xcode/Swift. I can make a pull request if you do not have time but the changes are very minor

    opened by bennnjamin 3
  • Implemented Swift Package Manager Support and Updated Project Files

    Implemented Swift Package Manager Support and Updated Project Files

    I have implemented the basic Swift Package Manager support and updated the project files to use the latest Xcode standard.

    Thanks for your work on this library!

    opened by LambdaDigamma 2
  • Update how_to_use.md

    Update how_to_use.md

    Cannot convert value of type '(_) -> UIViewController?' to expected argument type 'Alertift.Alert.Handler?' (aka 'Optional<(UIAlertAction, Int, Optional<Array<UITextField>>) -> ()>')
    
    opened by ykws 1
  • Cannot show Alertift

    Cannot show Alertift

    Here is the log when open:

    Warning: Attempt to present <Alertift.InnerAlertController: 0x7fd4f816d000> on <UINavigationController: 0x7fd4f8012a00> whose view is not in the window hierarchy!

    opened by mdtuyen 1
  • Add actions at once

    Add actions at once

    Alertift can only add action one by one for now. It will make it possible to add actions at once.

    Alertift.actionSheet(message: "Which food do you like?")
       .popover(sourceView: self.view, sourceRect: button.frame)
       .actions([.default("🍣"), .default("🍎"), .default("🍖"), .default("🍅")]) { action, index in
           if action.style == .cancel {
               return
           }
           Alertift.alert(message: "\(index). \(action.title!)")
               .action(.default("OK"))
               .show()
        }
        .show(on: self)
    
    enhancement 
    opened by sgr-ksmt 1
  • Added `ShortHandler`

    Added `ShortHandler`

    I just implemented ShortHandler. By using this ShortHandler, it is possible to avoid writing `(_, _, _) in closure if you don't use closure arguments.

    Before

    Alertift.alert(title: "Sample 2",message: "Do you like 🍣?")
        .action(.default("Yes"), isPreferred: true) { _, _, _ in
            Alertift.alert(message: "🍣🍣🍣")
                .action(.default("Close"))
                .show()
        }
        .action(.cancel("No")) { _, _, _ in
            Alertift.alert(message: "😂😂😂")
                .action(.destructive("Close"))
                .show()
        }
        .show()
    

    After

    Alertift.alert(title: "Sample 2",message: "Do you like 🍣?")
        .action(.default("Yes"), isPreferred: true) {
            Alertift.alert(message: "🍣🍣🍣")
                .action(.default("Close"))
                .show()
        }
        .action(.cancel("No")) {
            Alertift.alert(message: "😂😂😂")
                .action(.destructive("Close"))
                .show()
        }
        .show()
    

    Diff

    +     .action(.default("Yes"), isPreferred: true) {
    -     .action(.default("Yes"), isPreferred: true) { _, _, _ in
    
    opened by sgr-ksmt 0
  • Syntax error on Swift 4.2

    Syntax error on Swift 4.2

    hello. I found some problem with Swift 4.2 and Xcode 10, Legacy Build System(under File > Workspace Settings... )

    I use alertift 4.0 with cocoapds, It occurs syntax error at InnerAlertController.swift, Lines 162: source here

    func registerTextFieldObserver(_ textField: UITextField) {
            NotificationCenter.default.addObserver(
                self,
                selector: #selector(self.textFieldDidChange(_:)),
                name: UITextField.textDidChangeNotification, object: textField
            )
        }
    

    Xcode guides to fix it like this.

        func registerTextFieldObserver(_ textField: UITextField) {
            NotificationCenter.default.addObserver(
                self,
                selector: #selector(self.textFieldDidChange(_:)),
                name: Notification.Name.UITextFieldTextDidChange, object: textField
            )
        }
    

    I fork and clone this repo, and load demo app - I can't reappearance that error.

    opened by dotkebi 0
  • Add icon to UIAlertAction button

    Add icon to UIAlertAction button

    How can i add icon to Action button and set the text alignment to left on Action Button.

    For reference, you can see the whatsApp. I need exactly to WhatsApp action sheet. whatsapp image 2017-11-19 at 2 02 15 am

    opened by ErAshu 0
  • UIApplication.shared.keyWindow is deprecated since iOS 13

    UIApplication.shared.keyWindow is deprecated since iOS 13

    Using the pod creates a warning with the current Xcode, when creating apps for iOS 14 (and newer, in the future). Maybe remove the default value for viewController in the show method (AlertType.swift, line 154)?

    opened by kreuli 0
Releases(4.2.0)
Owner
Suguru Kishimoto
iOS/Web Developer and Technical Advisor for Firebase. 💖:Swift/TypeScript/Firebase/React
Suguru Kishimoto
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 22, 2022
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
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
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

Paolo Musolino 2.5k Jan 3, 2023
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
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.

Ali Samaiee 11 Jun 6, 2022
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

Paolo Musolino 2.5k Jan 3, 2023
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
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

Roland Moers 1.2k Dec 13, 2022
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

Roland Moers 542 Dec 5, 2022
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

Roland Moers 382 Dec 19, 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
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

Lightning Kite 97 Feb 8, 2022
Customizable replacement for UIAlertController

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

Horizontal Systems 0 Oct 6, 2022
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

Jay Choi 5 Feb 2, 2020
Use UIAlertController like a boss.

Description Requirements Installation CocoaPods Carthage Usage License Description CatAlertController is a high level manager object that with chainin

Kcat 8 Feb 8, 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
UIPicker inside a UIAlertController

DPPickerManager UIPicker inside a UIAlertController HOW TO USE : // Strings Picker let values = ["Value 1", "Value 2", "Value 3", "Value 4"] DPPickerM

Prioregroup.com 45 May 30, 2022