diff options
author | Gil <mcg@google.com> | 2018-04-15 13:06:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-15 13:06:06 -0700 |
commit | 5368c9e22f9a6b427466e9422645d688953013c0 (patch) | |
tree | 96ce766691fb24ffc0382cac472945b2190ecabe /Firestore/Example/SwiftBuildTest/main.swift | |
parent | 33b12f6c70729d56c6e6350d435559cec1c44c61 (diff) |
Replace the `SetOptions` object with a simple boolean. (#1098)
Instead of calling
`setData(["a": "b"], options: SetOptions.merge())`
call
`setData(["a": "b"], merge: true)`
Diffstat (limited to 'Firestore/Example/SwiftBuildTest/main.swift')
-rw-r--r-- | Firestore/Example/SwiftBuildTest/main.swift | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Firestore/Example/SwiftBuildTest/main.swift b/Firestore/Example/SwiftBuildTest/main.swift index 555a75b..ad6c0f6 100644 --- a/Firestore/Example/SwiftBuildTest/main.swift +++ b/Firestore/Example/SwiftBuildTest/main.swift @@ -118,8 +118,16 @@ func writeDocument(at docRef: DocumentReference) { print("Set complete!") } - // SetOptions - docRef.setData(setData, options: SetOptions.merge()) + // merge + docRef.setData(setData, merge: true) + docRef.setData(setData, merge: true) { error in + if let error = error { + print("Uh oh! \(error)") + return + } + + print("Set complete!") + } docRef.updateData(updateData) docRef.delete() @@ -156,6 +164,7 @@ func writeDocuments(at docRef: DocumentReference, database db: Firestore) { batch = db.batch() batch.setData(["a": "b"], forDocument: docRef) + batch.setData(["a": "b"], forDocument: docRef, merge: true) batch.setData(["c": "d"], forDocument: docRef) // commit without completion callback. batch.commit() @@ -355,7 +364,6 @@ func types() { let _: QueryListenOptions let _: Query let _: QuerySnapshot - let _: SetOptions let _: SnapshotMetadata let _: Transaction let _: WriteBatch |