STAlertController
A subclass of UIAlertController that can be presented one by one in a queue
STAlertController is a subclass of UIAlertController that can be presented one by one in a queue. When STAlertController is clicked and disappears, the next STAlertController will be presented.
Requirements
- iOS 8.0 or later
- ARC
- Swift 5.0
Installation
STAlertController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'STAlertController'Usage
Import headers in your source files
In the source files where you need to use the library, import the header file:
import STAlertControllerInitialize STAlertController
Use the following function to initialize the STAlertController:
let alertController = STAlertController(title: "Title", message: "Message", preferredStyle: .alert)Initialize STAlertAction
Use the following function to initialize the STAlertAction:
let alertAction = STAlertAction.createAction(title: "OK", style: .cancel) { action in
print("Clicked OK")
}AddAction
Use the following function to add the STAlertAction to the STAlertController:
alertController.addAction(alertAction)PresentAlertController
At last, use the following function to present the STAlertController on an instance of UIViewcontroller:
presentAlertController(alertController)DismissAlertController
Of course, the following methods can also be used to dimiss the STAlertController:
dismissAlertController()Author
Suta, [email protected]
