Skip to content

1. Single Button Alert

Gabriel Theodoropoulos edited this page Apr 17, 2019 · 1 revision

Single button alert

To present an alert controller that will contain the title, the message (both are optional values) and one button only using GTAlertCollection, here's what we need to do:

GTAlertCollection.shared.presentSingleButtonAlert(withTitle: "Welcome", message: "This is a simple alert!", buttonTitle: "Got it", actionHandler: {

    print("Single Button Alert - Action button was tapped")

})

Single-button Alert

The action button's title can be customised and specified in the buttonTitle parameter. The action handler closure is the place where we write all the code that should be executed after the user has tapped on the action button. The above example just prints a message when the button is tapped.

Clone this wiki locally