From 52c7329f2a74ad457898afebe21b1f02e35d0d0f Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Mon, 18 Dec 2017 18:50:08 -0800 Subject: 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 --- Firestore/Example/SwiftBuildTest/main.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Firestore/Example/SwiftBuildTest/main.swift') 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; -- cgit v1.2.3