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.
- iOS 8.0 or later
- ARC
- Swift 5.0
STAlertController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'STAlertController'
In the source files where you need to use the library, import the header file:
import STAlertController
Use the following function to initialize the STAlertController:
let alertController = STAlertController(title: "Title", message: "Message", preferredStyle: .alert)
Use the following function to initialize the STAlertAction:
let alertAction = STAlertAction.createAction(title: "OK", style: .cancel) { action in
print("Clicked OK")
}
Use the following function to add the STAlertAction to the STAlertController:
alertController.addAction(alertAction)
At last, use the following function to present the STAlertController on an instance of UIViewcontroller:
presentAlertController(alertController)
Of course, the following methods can also be used to dimiss the STAlertController:
dismissAlertController()
Suta, [email protected]