An alternative to using the native UIAlertController, with a thoughtful design and simple implementation

HPAlertController

An alternative to using the native UIAlertController, with a thoughtful design and simple implementation.

Requirements

iOS 15.0 and higher

Installation

Swift Package Manager:

dependencies: [
  .package(url: "https://github.com/hugo-pivaral/HPAlertController.git", .exact("1.0.0")),
],

After installing the SPM into your project import HPAlertController with

import HPAlertController

Usage

Using HPAlertController is simple, very much like using UIAlertController. Simply make an instance of HPAlertController with the info you want to be presented, add the actions from which to choose, and present the alert using the present(_:animated:completion:) method.

let alert = HPAlertController(title: "Successful",
                              message: "Your information has been updated on our server.",
                              icon: .success,
                              alertTintColor: .default)
        
let continueAction = HPAlertAction(title: "Continue", style: .default) {
    // do something
}

let cancelAction = HPAlertAction(title: "Cancel", style: .cancel)

alert.addAction(continueAction)
alert.addAction(cancelAction)

present(alert, animated: true)

Author

Hugo Pivaral

License

HPAlertController is under the MIT license. See LICENSE for details.

GitHub

View Github