質問編集履歴

2

文章の追加

2018/11/10 00:40

投稿

reeeeet
reeeeet

スコア95

test CHANGED
File without changes
test CHANGED
@@ -79,3 +79,35 @@
79
79
  Xcode 10.0
80
80
 
81
81
  Swift 3.0
82
+
83
+
84
+
85
+ ##書き込みデータのCODE
86
+
87
+ ```swift
88
+
89
+ Database.database().reference().child((Api.User.CURRENT_USER!.uid)).observeSingleEvent(of: .value, with: { snapshot in
90
+
91
+ let arraySnapshot = snapshot.children.allObjects as! [DataSnapshot]
92
+
93
+
94
+
95
+ // 書き込みデータ
96
+
97
+ arraySnapshot.forEach({ (child) in
98
+
99
+ guard let postId = newPostId else { return }
100
+
101
+ let newNotificationId = Api.Notification.REF_NOTIFICATION.child(child.key).childByAutoId().key
102
+
103
+ guard let notificationId = newNotificationId else { return }
104
+
105
+ let newNotificationReference = Api.Notification.REF_NOTIFICATION.child(child.key).child(notificationId)
106
+
107
+ newNotificationReference.setValue(["from": Api.User.CURRENT_USER!.uid, "type": "feed", "objectId": postId, "timestamp": timestamp])
108
+
109
+ })
110
+
111
+ })
112
+
113
+ ```

1

2018/11/10 00:40

投稿

reeeeet
reeeeet

スコア95

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,15 @@
67
67
  **また、どうやって解決したら良いでしょうか?**
68
68
 
69
69
  すみませんが、よろしくお願いします。
70
+
71
+
72
+
73
+
74
+
75
+ ##開発環境
76
+
77
+ MacOS Mojave 10.14
78
+
79
+ Xcode 10.0
80
+
81
+ Swift 3.0