回答編集履歴
2
インデントミス対応
test
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
identifier == "sendingmessege" else {
|
42
42
|
|
43
|
-
return
|
43
|
+
return
|
44
44
|
|
45
45
|
}
|
46
46
|
|
1
インデントがおかしかったので変更
test
CHANGED
@@ -16,49 +16,55 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
|
19
|
+
class FirstViewController: UIViewController {
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
@IBOutlet weak var send_text: UITextField! //入力用テキストフィールド
|
24
|
+
|
25
|
+
|
24
26
|
|
25
27
|
override func viewDidLoad() {
|
26
28
|
|
27
29
|
super.viewDidLoad()
|
28
30
|
|
29
|
-
}
|
31
|
+
}
|
30
32
|
|
31
33
|
|
32
34
|
|
33
|
-
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
35
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
34
36
|
|
35
|
-
// Segue の Identifier が nil または sendingmessege でない場合は処理を抜ける
|
37
|
+
// Segue の Identifier が nil または sendingmessege でない場合は処理を抜ける
|
36
38
|
|
39
|
+
guard let identifier = segue.identifier,
|
40
|
+
|
37
|
-
|
41
|
+
identifier == "sendingmessege" else {
|
38
42
|
|
39
43
|
return
|
40
44
|
|
41
|
-
}
|
45
|
+
}
|
42
46
|
|
43
|
-
// Segue の行き先が SecondViewController かを確認
|
47
|
+
// Segue の行き先が SecondViewController かを確認
|
44
48
|
|
45
|
-
if let secondViewController = segue.destination as? SecondViewController {
|
49
|
+
if let secondViewController = segue.destination as? SecondViewController {
|
46
50
|
|
47
|
-
// プロパティにテキストフィールドの値を渡す
|
51
|
+
// プロパティにテキストフィールドの値を渡す
|
48
52
|
|
49
|
-
secondViewController.receivedStr = self.send_text.text
|
53
|
+
secondViewController.receivedStr = self.send_text.text
|
54
|
+
|
55
|
+
}
|
50
56
|
|
51
57
|
}
|
52
58
|
|
53
|
-
}
|
54
59
|
|
55
60
|
|
61
|
+
// ボタン押下時の処理(ボタンから直接 Segue を出している場合は不要)
|
56
62
|
|
57
|
-
|
63
|
+
@IBAction func sendAction(_ sender: Any) {
|
58
64
|
|
59
|
-
|
65
|
+
performSegue(withIdentifier: "sendingmessege", sender: nil)
|
60
66
|
|
61
|
-
|
67
|
+
}
|
62
68
|
|
63
69
|
}
|
64
70
|
|