回答編集履歴
1
VC側に変数用意
answer
CHANGED
@@ -16,7 +16,29 @@
|
|
16
16
|
if let nextVC = segue.destination as? EditViewController,
|
17
17
|
let index = sender as? Int {
|
18
18
|
// モデルそのものを渡した方が良いかと(itemList[index])
|
19
|
-
nextVC.
|
19
|
+
nextVC.passedId = itemList[index].id
|
20
|
+
// nextVC.item = itemList[index]
|
20
21
|
}
|
21
22
|
}
|
23
|
+
```
|
24
|
+
|
25
|
+
```
|
26
|
+
import UIKit
|
27
|
+
|
28
|
+
class EditViewController: UIViewController {
|
29
|
+
|
30
|
+
// 値渡し用の変数定義
|
31
|
+
var passedId: Int!
|
32
|
+
// var item: 型!
|
33
|
+
@IBOutlet weak var label: UILabel!
|
34
|
+
|
35
|
+
override func viewDidLoad() {
|
36
|
+
super.viewDidLoad()
|
37
|
+
|
38
|
+
label.text = (passedId)
|
39
|
+
// label.text = (item.id)
|
40
|
+
|
41
|
+
// Do any additional setup after loading the view.
|
42
|
+
}
|
43
|
+
}
|
22
44
|
```
|