質問編集履歴
2
ソースコードの変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,7 +50,6 @@
|
|
50
50
|
|
51
51
|
let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
|
52
52
|
print(document.data() as Any)
|
53
|
-
print(document.value(forKey: "userName") as Any)
|
54
53
|
print("Document data: (dataDescription)")
|
55
54
|
/*
|
56
55
|
print(document.dictionaryWithValues(forKeys: ["birthday"])
|
1
タイトルの変更と説明の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
### 実現したいこと
|
2
2
|
|
3
|
-
SwiftにおいてCloud Firestoreに保存したデータ(userName
|
3
|
+
SwiftにおいてCloud Firestoreに保存したデータ(userNameの値を)取得し、UILabelに反映させたい。
|
4
4
|
|
5
5
|
### 現状
|
6
6
|
|
@@ -36,6 +36,9 @@
|
|
36
36
|
### データを取得するソースコード
|
37
37
|
|
38
38
|
```Swift
|
39
|
+
|
40
|
+
@IBOutlet weak var userNameLabel: UILabel!
|
41
|
+
|
39
42
|
func getUserInfo() {
|
40
43
|
|
41
44
|
let db = Firestore.firestore()
|
@@ -53,6 +56,8 @@
|
|
53
56
|
print(document.dictionaryWithValues(forKeys: ["birthday"])
|
54
57
|
print(document.dictionaryWithValues(forKeys: ["profileImage"])
|
55
58
|
*/
|
59
|
+
|
60
|
+
userNameLabel.text = ここにCloud Firestoreに保存されたuserNameの値を入れたい
|
56
61
|
|
57
62
|
|
58
63
|
} else {
|
@@ -63,12 +68,16 @@
|
|
63
68
|
}
|
64
69
|
|
65
70
|
}
|
66
|
-
```
|
71
|
+
```
|
67
72
|
|
68
73
|
### ログ画面(データ取得)
|
69
74
|
|
70
75
|

|
71
76
|
|
77
|
+
### 発生している問題
|
78
|
+
|
79
|
+
値の取得方法が分からず、UIlabal.textに値を渡せない。
|
80
|
+
|
72
81
|
### 試したこと
|
73
82
|
|
74
83
|
Cloud Firestoreのドキュメントを見ながらやってみましたが、値の取り出し方がどこに書いてあるのか見つけられませんでした。
|