DatabaseReference
public extension DatabaseReference
-
Encodes an instance of
Encodable
and overwrites the encoded data to the path referred by thisDatabaseReference
. If no value exists, it is created. If a value already exists, it is overwritten.See
Database.Encoder
for more details about the encoding process.Declaration
Swift
func setValue<T: Encodable>(from value: T, encoder: Database.Encoder = Database.Encoder(), completion: ((Error?) -> Void)? = nil) throws
Parameters
value
An instance of
Encodable
to be encoded to a document.encoder
An encoder instance to use to run the encoding.
completion
A block to execute once the value has been successfully written to the server. This block will not be called while the client is offline, though local changes will be visible immediately.