回答編集履歴
1
VC側に変数用意
test
CHANGED
@@ -34,10 +34,54 @@
|
|
34
34
|
|
35
35
|
// モデルそのものを渡した方が良いかと(itemList[index])
|
36
36
|
|
37
|
-
nextVC.
|
37
|
+
nextVC.passedId = itemList[index].id
|
38
|
+
|
39
|
+
// nextVC.item = itemList[index]
|
38
40
|
|
39
41
|
}
|
40
42
|
|
41
43
|
}
|
42
44
|
|
43
45
|
```
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
```
|
50
|
+
|
51
|
+
import UIKit
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
class EditViewController: UIViewController {
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
// 値渡し用の変数定義
|
60
|
+
|
61
|
+
var passedId: Int!
|
62
|
+
|
63
|
+
// var item: 型!
|
64
|
+
|
65
|
+
@IBOutlet weak var label: UILabel!
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
override func viewDidLoad() {
|
70
|
+
|
71
|
+
super.viewDidLoad()
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
label.text = (passedId)
|
76
|
+
|
77
|
+
// label.text = (item.id)
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
// Do any additional setup after loading the view.
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
```
|