Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 5.0

Installation

CocoaPods

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

pod 'Square', '~> 0.6.3'

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

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
    }
}

Useful functions

Square.debugAlert()

above a method is useful when you need to know where the function is running

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

About

Square's purpose is that to use UIAlertController easily🧩

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages