回答編集履歴
1
コードの修正
test
CHANGED
@@ -20,7 +20,11 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
override func
|
23
|
+
override func viewDidLoad() {
|
24
|
+
|
25
|
+
super.viewDidLoad()
|
26
|
+
|
27
|
+
// Realm からデータの読み込みを行います
|
24
28
|
|
25
29
|
let realm = try! Realm()
|
26
30
|
|
@@ -28,9 +32,17 @@
|
|
28
32
|
|
29
33
|
// 読み込みのタイミングで配列に変換
|
30
34
|
|
31
|
-
|
35
|
+
tweets = Array(realm.objects(Tweet.self))
|
32
36
|
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
42
|
+
|
43
|
+
// 保持している `Tweet` の配列の要素数を返す
|
44
|
+
|
33
|
-
return tweet
|
45
|
+
return tweets.count
|
34
46
|
|
35
47
|
}
|
36
48
|
|