Giter VIP home page Giter VIP logo

pmalertcontroller's Introduction

Icon

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!

Icon

Features


  • 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

Requirements


  • iOS 9.0+
  • Xcode 10+

CocoaPods


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'
use_frameworks!

pod 'PMAlertController'

Then, run the following command:

$ pod install

Carthage


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.

Manually


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

Usage


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

Contributing

  • 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.

Acknowledgements

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.

pmalertcontroller's People

Contributors

942v avatar albinekcom avatar andrewsb avatar blog404de avatar gorbat-o avatar jackyoustra avatar josecostamartins avatar klauslanza avatar lfarah avatar macteo avatar owlcoding avatar pasevin avatar pmusolino avatar prscx avatar shaoxinsen avatar themakew avatar vittoriom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.