SCLAlertView-Swift
SCLAlertView-Swift copied to clipboard
Get text from the TextField
hello I used this method to create the button _ = alert.addButton("Submit", target:self, selector:#selector(ViewController.firstButton))
how will i reference the text inside the textfield in the firstButton method
The addTextField method returns the UITextField instance you are interested in. Just save it as a property of your view controller and you can use it anywhere.
Regards! this is an example that is in the readme.md
// Add a text field
let alert = SCLAlertView()
let txt = alert.addTextField("Enter your name")
alert.addButton("Show Name") {
print("Text value: \(txt.text)")
}
alert.showEdit("Edit View", subTitle: "This alert view shows a text box")