質問編集履歴
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -182,4 +182,62 @@
|
|
182
182
|
**データB**
|
183
183
|

|
184
184
|
**データA**
|
185
|
-

|
185
|
+

|
186
|
+
|
187
|
+
### 修正後ソースコード
|
188
|
+
```swift
|
189
|
+
if select == "selected" {
|
190
|
+
|
191
|
+
//選択したタグに関連がある内容のみ表示する
|
192
|
+
self.timelines.removeAll()
|
193
|
+
|
194
|
+
//現段階ではcircleNameがMr'UniverCityの内容のみ呼び出している
|
195
|
+
//これをtagListsがuserのtagListsと一つでも一致していれば表示の形に変えなければならない
|
196
|
+
|
197
|
+
|
198
|
+
//自分のtaglistを読み込む
|
199
|
+
|
200
|
+
HUD.show(.progress)
|
201
|
+
**データA**
|
202
|
+
let docRef = defaultStore.collection("TagLists").document(self.userID)
|
203
|
+
docRef.getDocument { (snapshot, error) in
|
204
|
+
if error == nil, let snapshot = snapshot ,let data = snapshot.data(){
|
205
|
+
|
206
|
+
let tagLists = data["tagLists"]! as! Array<Any>
|
207
|
+
print(tagLists as Any)
|
208
|
+
|
209
|
+
|
210
|
+
//読み込んだタグと照らし合わせる
|
211
|
+
**データB**
|
212
|
+
self.defaultStore.collection("CirclePost").whereField("tagLists", isEqualTo: tagLists)
|
213
|
+
.getDocuments() { (documentSnapshot, err) in
|
214
|
+
if let err = err {
|
215
|
+
print("Error getting documents: (err)")
|
216
|
+
} else {
|
217
|
+
for document in documentSnapshot!.documents {
|
218
|
+
print("(document.documentID) => (document.data())")
|
219
|
+
|
220
|
+
let documentSnapshot = document as DocumentSnapshot
|
221
|
+
let timeline = CircleDataModel(snapshot: documentSnapshot)
|
222
|
+
print(timeline)
|
223
|
+
self.timelines.insert(timeline, at: 0)
|
224
|
+
let documentID = documentSnapshot.documentID
|
225
|
+
|
226
|
+
print("投稿者のドキュメントIDが取得できる")
|
227
|
+
print(documentID)
|
228
|
+
}
|
229
|
+
self.tableView.reloadData() // 先ほど書いたprint文をこちらに変更
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
} else {
|
236
|
+
print("Document does not exist")
|
237
|
+
}
|
238
|
+
HUD.hide()
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
} else { ---省略---
|
243
|
+
```
|
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
**データA**
|
68
68
|
HUD.show(.progress)
|
69
|
-
let docRef = defaultStore.collection("
|
69
|
+
let docRef = defaultStore.collection("TagLists").document(self.userID)
|
70
70
|
docRef.getDocument { (snapshot, error) in
|
71
71
|
if error == nil, let snapshot = snapshot ,let data = snapshot.data(){
|
72
72
|
|
1
誤字
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
swift firestore での条件付き検索
|
1
|
+
swift firestore での条件付き検索を実現したい
|
body
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
HUD.hide()
|
80
80
|
}
|
81
81
|
**データB**
|
82
|
-
**そもそもこのwhereFieldのisEqualToに配列を入れられ
|
82
|
+
**そもそもこのwhereFieldのisEqualToに配列を入れられるのかが分からない**
|
83
83
|
//読み込んだタグと照らし合わせる
|
84
84
|
defaultStore.collection("CirclePost").whereField("tagLists", isEqualTo: tagLists)
|
85
85
|
.getDocuments() { (documentSnapshot, err) in
|