質問編集履歴
1
コードを全文追記いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,38 @@
|
|
1
1
|
```ここに言語を入力
|
2
2
|
|
3
|
+
|
4
|
+
|
5
|
+
import UIKit
|
6
|
+
|
7
|
+
import Firebase
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
class ViewController: UIViewController {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
@IBOutlet weak var registerButton: UIButton!
|
16
|
+
|
17
|
+
@IBOutlet weak var emailTextField: UITextField!
|
18
|
+
|
19
|
+
@IBOutlet weak var passwordTextField: UITextField!
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
@IBAction func tappedRegisterButton(_ sender: Any) {
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
guard let email = emailTextField.text else { return }
|
30
|
+
|
31
|
+
guard let password = passwordTextField.text else { return }
|
32
|
+
|
33
|
+
|
34
|
+
|
3
|
-
Auth.auth().signIn(withEmail: email, password: password) { (res, err) in
|
35
|
+
Auth.auth().signIn(withEmail: email, password: password) { (res, err) in
|
4
36
|
|
5
37
|
if let err = err {
|
6
38
|
|
@@ -10,6 +42,64 @@
|
|
10
42
|
|
11
43
|
}
|
12
44
|
|
45
|
+
print("成功")
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
override func viewDidLoad() {
|
56
|
+
|
57
|
+
super.viewDidLoad()
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
registerButton.isEnabled = false
|
62
|
+
|
63
|
+
registerButton.layer.cornerRadius = 10
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
emailTextField.delegate = self
|
68
|
+
|
69
|
+
passwordTextField.delegate = self
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
extension ViewController: UITextFieldDelegate {
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
func textFieldDidChangeSelection(_ textField: UITextField) {
|
80
|
+
|
81
|
+
let emailIsEmpty = emailTextField.text?.isEmpty ?? true
|
82
|
+
|
83
|
+
let passwordIsEmpty = passwordTextField.text?.isEmpty ?? true
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
if emailIsEmpty || passwordIsEmpty {
|
88
|
+
|
89
|
+
registerButton.isEnabled = false
|
90
|
+
|
91
|
+
} else{
|
92
|
+
|
93
|
+
registerButton.isEnabled = true
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
13
103
|
```
|
14
104
|
|
15
105
|
|
@@ -18,7 +108,21 @@
|
|
18
108
|
|
19
109
|
|
20
110
|
|
111
|
+
この文の、
|
112
|
+
|
113
|
+
Auth.auth().signIn(withEmail: email, password: password) { (res, err) in
|
114
|
+
|
115
|
+
if let err = err {
|
116
|
+
|
117
|
+
print("失敗: ", err)
|
118
|
+
|
119
|
+
return
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
の部分に、
|
124
|
+
|
21
|
-
|
125
|
+
Cannot find 'Auth' in scope
|
22
126
|
|
23
127
|
というエラーコードが出てしまいます。
|
24
128
|
|