-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.swift
More file actions
34 lines (23 loc) · 1019 Bytes
/
ViewController.swift
File metadata and controls
34 lines (23 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var loginTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var resultLabel: UILabel!
@IBAction func loginButton(_ sender: UIButton) {
performSegue(withIdentifier: "detailSegue", sender: nil)
}
@IBAction func unWideSegueToMainScreen (segue: UIStoryboardSegue){
guard segue.identifier == "unwindSegue" else { return }
guard let svc = segue.source as? SecondViewController else { return }
if let logOut = svc.login {
self.resultLabel.text = "Goodbye, \(logOut)"
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let dvc = segue.destination as? SecondViewController else { return }
dvc.login = loginTextField.text
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true)
}
}