diff options
author | Greg Soltis <gsoltis@google.com> | 2017-12-18 18:50:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-18 18:50:08 -0800 |
commit | 52c7329f2a74ad457898afebe21b1f02e35d0d0f (patch) | |
tree | 8f5da4cb4ad1b61d46a0f3ad4195a59f2d95ebc4 /Firestore/Example/SwiftBuildTest/main.swift | |
parent | 8db0eb618d355c546e8f0894dc1e0799297c5659 (diff) |
Expose network management (#566)
* Expose network management in public API
* Clean up a few more references to the internal access of network management
* Move test
* Update comments
* Swap _Nullable for nullable
* Fix comment
* Add tests, including swift
* Styling
Diffstat (limited to 'Firestore/Example/SwiftBuildTest/main.swift')
-rw-r--r-- | Firestore/Example/SwiftBuildTest/main.swift | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Firestore/Example/SwiftBuildTest/main.swift b/Firestore/Example/SwiftBuildTest/main.swift index c05f378..f62bf48 100644 --- a/Firestore/Example/SwiftBuildTest/main.swift +++ b/Firestore/Example/SwiftBuildTest/main.swift @@ -39,6 +39,8 @@ func main() { listenToDocuments(matching: query); + enableDisableNetwork(db: db); + types(); } @@ -131,6 +133,23 @@ func writeDocument(at docRef: DocumentReference) { } } +func enableDisableNetwork(db db: Firestore) { + // closure syntax + db.disableNetwork(completion: { (error) in + if let e = error { + print("Uh oh! \(e)") + return + } + }) + // trailing block syntax + db.enableNetwork { (error) in + if let e = error { + print("Uh oh! \(e)") + return + } + } +} + func writeDocuments(at docRef: DocumentReference, database db: Firestore) { var batch: WriteBatch; |