Swift: Insert Alert Box with Text Input (and Store Text Input )
In one of my viewController , I want to make an alert box appear that prompts the user to type this information.Then, I want the user to store this input using NSUserDefaults . How can I achieve this? Thank you in advance! Andrei Papancea Check this out: let alertController = UIAlertController(title: "Email?", message: "Please input your email:", preferredStyle: .alert) let confirmAction = UIAlertAction(title: "Confirm", style: .default) { (_) in guard let textFields = alertController.textFields, textFields.count > 0 else { // Could not find textfield return } let field = textFields[0] //