質問編集履歴

1

コードに間違いがあったため

2020/04/02 16:01

投稿

Natsu.mikan
Natsu.mikan

スコア6

test CHANGED
File without changes
test CHANGED
@@ -32,9 +32,13 @@
32
32
 
33
33
  VStack {
34
34
 
35
- ForEach(self.fetcher.items) { (item: ItemList) in
35
+ ForEach(self.fetcher.items) { (item: Item) in
36
36
 
37
- NavigationLink(destination: DetailView(id: item.id))
37
+ NavigationLink(destination: DetailView(id: item.id)) {
38
+
39
+ Text(item.title)
40
+
41
+ }
38
42
 
39
43
  }
40
44
 
@@ -46,15 +50,13 @@
46
50
 
47
51
  }
48
52
 
53
+ struct DetailView: View {
49
54
 
50
-
51
- struct DetailView: View {
55
+ var id: String
52
56
 
53
57
  @ObservedObject private var fetcher = Fetcher()
54
58
 
55
59
  @Environment(.presentationMode) private var presentationMode: Binding<PresentationMode>
56
-
57
- var id: String
58
60
 
59
61
 
60
62
 
@@ -96,7 +98,7 @@
96
98
 
97
99
  init() {
98
100
 
99
- lists = realm.objects(Item.self)
101
+ items = realm.objects(Item.self)
100
102
 
101
103
 
102
104