Swiftpack.co - Package - pmusolino/PMAlertController


Language GitHub license Pod version Carthage Compatible Downloads

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable alert that you can use in your iOS app. Enjoy!



  • ☑ Header View
  • ☑ Header Image (Optional)
  • ☑ Title
  • ☑ Description message
  • ☑ Customizations: fonts, colors, dimensions & more
  • ☑ 1, 2 buttons (horizontally) or 3+ buttons (vertically)
  • ☑ Closure when a button is pressed
  • ☑ Text Fields support
  • ☑ Similar implementation to UIAlertController
  • ☑ Cocoapods
  • ☑ Carthage
  • ☑ Animation with UIKit Dynamics
  • ☑ Objective-C compatibility
  • ☑ Swift 4, Swift 4.2 & Swift 5 support
  • ☐ Swift Package Manager


  • iOS 9.0+
  • Xcode 10+


CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate PMAlertController into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

pod 'PMAlertController'

Then, run the following command:

$ pod install


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate PMAlertController into your Xcode project using Carthage, specify it in your Cartfile:

github "pmusolino/PMAlertController"

Run carthage update to build the framework and drag the built PMAlertController.framework into your Xcode project.


  1. Download and drop /Library folder in your project.
  2. Congratulations!


The usage is very similar to UIAlertController. PMAlertController has two styles: Alert & Walkthrough.

Alert Style: with this style, the alert has the width of 270 points, like Apple's UIAlertController.

Walkthrough Style: with walkthrough, the alert has the width of the screen minus 18 points from the left and the right bounds. This mode is intended to be used before authorization requests like the ones for location, push notifications and more.

Show a simple alert with two buttons and one textfield

//This code works with Swift 5

let alertVC = PMAlertController(title: "A Title", description: "My Description", image: UIImage(named: "img.png"), style: .alert)

alertVC.addAction(PMAlertAction(title: "Cancel", style: .cancel, action: { () -> Void in
            print("Capture action Cancel")

alertVC.addAction(PMAlertAction(title: "OK", style: .default, action: { () in
            print("Capture action OK")

alertVC.addTextField { (textField) in
            textField?.placeholder = "Location..."

self.present(alertVC, animated: true, completion: nil)

Swift compatibility

Third Party Bindings

React Native

You may now use this library with React Native via the module here


  • If you need help or you'd like to ask a general question, open an issue.
  • 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.


Made with ❤️ by Paolo Musolino.

Follow me on:

💼 Linkedin

🤖 Twitter

🌇 Instagram

👨🏼‍🎤 Facebook

MIT License

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


Stars: 2168


Used By

Total: 0


- 2019-03-27 16:43:29

  • Support for Swift 5 and Xcode 10.2
  • Added alert content stack view and alert style properties + validations to hide the title and description labels if the passed strings are nil https://github.com/pmusolino/PMAlertController/pull/82
  • Allow custom text fields to be added. https://github.com/pmusolino/PMAlertController/pull/76

- 2018-09-23 16:24:06

  • Support for Swift 4.2 and Xcode 10 https://github.com/pmusolino/PMAlertController/pull/71
  • Allow objective-c classes to access gravityDismissAnimation & dismissWithBackgroudTouch https://github.com/pmusolino/PMAlertController/pull/70

- 2018-04-22 19:26:14

  • Now the alert has new custom paddings https://github.com/pmusolino/PMAlertController/pull/61
  • Added React Native module in readme https://github.com/pmusolino/PMAlertController/pull/62

- 2018-04-10 16:37:27

  • Fix warnings on Xcode 9.3
  • Updated project URL on podspec file

- 2018-01-16 14:24:40

Now the PMAlertAction callback is called after that the alert was dismissed.


  • https://github.com/Codeido/PMAlertController/issues/56

- 2017-12-12 12:09:52

Now you can hide text labels easily. The alert resizes itself accordingly.

- 2017-09-25 18:33:20

Swift 4 and Xcode 9 support

- 2017-08-29 09:01:15

Separator property inside PMAlertAction is now "open"

References: https://github.com/Codeido/PMAlertController/issues/50

- 2017-03-29 09:27:48

Deprecated M_PI in Swift 3.1 substituted with Double.pi

References: https://github.com/Codeido/PMAlertController/pull/41

- 2017-03-21 10:07:35

Now is possible to dismiss an alert with a background tap. This feature is disabled by default, so no worries for standard usage.

References: https://github.com/Codeido/PMAlertController/pull/38

- 2017-01-18 12:02:15

PMAlertController now supports Text Fields! :confetti_ball:

Add a text field is really simple

alertVC.addTextField { (textField) in
            textField?.placeholder = "Location..."

References: https://github.com/Codeido/PMAlertController/pull/27 https://github.com/Codeido/PMAlertController/pull/34

- 2016-10-01 09:37:16

Fix header UIImageView constraints

- 2016-09-18 18:55:49

Swift 3.0 and Xcode 8 support.

Changes: This new version now use a header view instead of image, that is more flexible for show dynamic information besides the title and text. The old imageview is now contained inside the header view.

  • alertImageHeightConstraint has been replaced by headerViewHeightConstraint

References: https://github.com/Codeido/PMAlertController/issues/14 https://github.com/Codeido/PMAlertController/issues/15

- 2016-09-14 14:27:13

Swift 2.3 and Xcode 8 support + optimizations. Available on Cocoapods.


pod 'PMAlertController' , '~> 1.1.0'

- 2016-08-03 09:14:43

Now alertStackViewHeightConstraint is public. See this pull request for more info: https://github.com/Codeido/PMAlertController/pull/21

NB: this release use Swift 2.2.

- 2016-05-27 13:37:46

  • Different animation between Cancel And Default

- 2016-05-22 16:55:33

  • Carthage support

- 2016-05-21 14:06:21

  • Objective-C compatibility

- 2016-05-19 15:03:22

  • Now some properties are marked as public.
  • Animation dismiss with gravity, using UIKit Dynamics

1.0.0 first release - 2016-05-18 08:28:31