DatabaseReference
public extension DatabaseReference-
Encodes an instance of
Encodableand 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.Encoderfor more details about the encoding process.Declaration
Swift
func setValue<T: Encodable>(from value: T, encoder: Database.Encoder = Database.Encoder(), completion: ((Error?) -> Void)? = nil) throwsParameters
valueAn instance of
Encodableto be encoded to a document.encoderAn encoder instance to use to run the encoding.
completionA 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.