One Quickie

Using UIAlertController (UIKit->Swift)
Here's some moving parts for UIAlertController and friends, also does the username/password alert jazz.
func showLoginPanel() {
    let alertTitle = "Please enter your Equifax username and password"
    let message = "We will only use this information for good, not evil."
    let alertController = UIAlertController.init(title: alertTitle,
                                                 message: message,
                                                 preferredStyle: .alert)
    alertController.addTextField { textfield in
        textfield.placeholder = "Equifax Username"
    alertController.addTextField { textfield in
        textfield.placeholder = "Password"
        textfield.isSecureTextEntry = true
    let stopAction = UIAlertAction(title: "Login",
                                   style: .default) 
    { action in
        guard let login = alertController.textFields?.first,
            let password = alertController.textFields?.last else {
                print("This is wholly unexpected")

        print("Do things with: (login.text!)")
    let cancelAction = UIAlertAction(title: "Cancel",
                                     style: .cancel,
                                     handler: nil)

    present(alertController, animated: true)

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book