Giter Club home page Giter Club logo

square's Introduction

Square

Swift Build Status pod compatible Carthage compatible

Square's purpose is that to use UIAlertController easily.

Requirements

Square requires iOS 8 or above and is written in Swift 4.2

Installation

CocoaPods

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

pod 'Square', '~> 0.3.0'

And run pod install.

Carthage

Suqare is available through Carthage. Simply install carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

add Suqare to your Cartfile:

github "devmjun/Square" ~> 0.3.0

And run carthage update.

Usage

One Button Alert


// 1
Square.display("Title")

// 2
Square.display("Title", message: "Title")

// 3
Square.display("Title", message: "Title", alertAction: .default(messgae: "OK")) {
		print("Action!")
}

Multiple Button Alerts


Square.display("Title", message: "Message", alertActions: [.cancel(message: "Cancel"), .destructive(message: "Detructive"), .default(messgae: "Default")]) { (alertAction, index) in
    if index == 0 {
        // Cancel action
        
    }else if index == 1 {
        // Destructive action
        
    }else if index == 2 {
        // Default action
    }
}

Action Sheet

One Button Alert


Square.display("Title", message: "Message", alertAction: .default(messgae: "OK"), preferredStyle: .actionSheet) {
            // Alert Action   
}

Multiple Button Alerts


Square.display("Title", message: "Message", alertActions: [.cancel(message: "Cancel"), .destructive(message: "Detructive"), .default(messgae: "Default")], preferredStyle: .actionSheet) { (alertAction, index) in
    if index == 0 {
        // Cancel action
        
    }else if index == 1 {
        // Destructive action
        
    }else if index == 2 {
        // Default action
    }
}

Customize

let alertController = Square.display("Title")
alertController.setValue(attributedTitle, forKey: "attributedTitle")
alertController.setValue(attributedMessage, forKey: "attributedMessage")
alertController.view.tintColor =  SomeColor

Contributing

Bug reports, pull request and any discussion are welcome💖

License

Square is available as open source under the terms of the MIT License

square's People

Contributors

devmjun avatar

Watchers

James Cloos avatar Carabineiro 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.