GithubHelp home page GithubHelp logo

devhplusn / alerts Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

Alerts is a library that handles UIAlertController using the Method Chain pattern.

License: MIT License

Ruby 2.23% Swift 97.77%

alerts's Introduction

Alerts

Swift Platforms GitHub license

Alerts is a library that handles UIAlertController using the Method Chain pattern.

Requirements

  • Swift 5
  • iOS 11.0+

Installation

Swift Package Manager

You can use The Swift Package Manager to install Alerts by adding the proper description to your Package.swift file:

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .package(url: "https://github.com/devhplusn/Alerts.git", from: "1.0.0")
    ]
)

Then run swift package update.

Cocoapods

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

pod 'Alerts', :tag => '1.0.0', :git => 'https://github.com/devhplusn/Alerts'

Usage

Alert Type

  • Basic
Alert(title: "Title", message: "Message", tintColor: .black)
    .addAction("OK", style: .default, isEnabled: true, titleColor: .black) { controller in
        // you can handle here when user tapped this UIAlertAction
    }.addAction("Cancel", style: .cancel)
    .present(at: self)
  • With textField
Alert(title: "Title", message: "Message", tintColor: .black)
    .addTextField { textField in
        // you can configuration textField.
    } textDidChange: { controller, textField in
        // you can handle it when the text of the textField changes.

    }.textFieldDidChange { controller, index in
        // you can handle it when the text of the textFields changes.

    }.addAction("OK", style: .default, isEnabled: true, titleColor: .black) { controller in
        // you can handle it when the user taps this UIAlertAction.

    }.addAction("Cancel", style: .cancel)
    .present(at: self)

ActionSheet Type

ActionSheet(title: "Title", message: "Message")
    .addAction("OK", isEnabled: false) { controller in
        // you can handle here when user tapped this UIAlertAction
    }.addAction("Cancel", style: .cancel)
    .present(at: self)

License

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

alerts's People

Contributors

devhplusn avatar

Stargazers

 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.