keyvan yaghoubian
keyvan yaghoubian

Reputation: 322

How to create an array in firebase database in iOS swift

How to create an Array in Firebase realtime database in iOS using swift

note : I want to be able to append new elements without getting array value first an add element locally then setting it to database .

Upvotes: 0

Views: 889

Answers (2)

ali aghajani
ali aghajani

Reputation: 36

use childByAutoId()

Database.database().reference().child("arrayKey").childByAutoId().setValue("Value") }

Upvotes: 2

Alastar
Alastar

Reputation: 1374

This should be achieved easily:

let ref = storageRef.child("your_child")
let array = ["First", "Second", "Third", "Fourth"]
ref.setValue(array)

Upvotes: 1

Related Questions