Firebase Fast equivalent to push ()

In Javascript, a call using firebase ref generates a random identifier. Then you can fill in the material below.

However, I cannot find a push in Swift. Should I generate random identifiers myself?

+5
source share
1 answer

I think you are looking for childByAutoId() :

childByAutoId generates a new child location using a unique key and returns a FIRDatabaseReference to it. This is useful when children from a Firebase database database present a list of items.

The unique key generated by childByAutoId: has a prefix with a timestamp created by the client, so that the resulting list will be chronologically sorted.

Statement

 func childByAutoId() -> FIRDatabaseReference 

Also see: https://firebase.google.com/docs/database/ios/read-and-write#update_specific_fields

+5
source

Source: https://habr.com/ru/post/1265589/


All Articles