Skip to content

Repository files navigation

UIAlertController_Blocks.swift

Installation

Cocoapods

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

pod'UIAlertController_Blocks.swift'

Swift Package Manager

Add https://github.com/iBinh/UIAlertController_Blocks.swift.git to Package Manager

Usage

Show ActionSheet

UIAlertController.showActionSheet(title:"Title", message:"Message", cancelButtonTitle:"Cancel", destructiveButtonTitle:"Delete", otherButtonTitles:["First Button","Second Button"], popoverPresentationControllerBlock:{(popover)in
popover?.sourceView =self.someButton
popover?.sourceRect =self.someButton.bounds
}){(controller, action, index)inif index == controller.firstOtherButtonIndex {
// do some stuff
}elseif index == controller.firstOtherButtonIndex +1{
// do some stuff
}elseif index == controller.destructiveButtonIndex {
// do some stuff
} // do some stuff
}

Show Alert

UIAlertController.showAlert(title:"Title", message:"Message", cancelButtonTitle:"Cancel", destructiveButtonTitle:"Delete", otherButtonTitles:["First Button","Second Button"], popoverPresentationControllerBlock:{(popover)in
popover?.sourceView =self.someButton
popover?.sourceRect =self.someButton.bounds
}){(controller, action, index)inif index == controller.firstOtherButtonIndex {
// do some stuff
}elseif index == controller.firstOtherButtonIndex +1{
// do some stuff
}elseif index == controller.destructiveButtonIndex {
// do some stuff
} // do some stuff
}

Author

Inspired from ryanmaxwell/UIAlertController-Blocks

ntbinh2121, ntbinh21@gmail.com

License

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

About

Easy UIAlertController with blocks

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages