From 52cdf0b25a12b5baed8546893634dab9c1a03e56 Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 18 Dec 2017 21:05:07 -0800 Subject: Clean up warnings (#578) * Clean up warnings * Remove optional parens around ifs --- Firestore/Example/SwiftBuildTest/main.swift | 41 +++++++++++++++-------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'Firestore/Example/SwiftBuildTest/main.swift') diff --git a/Firestore/Example/SwiftBuildTest/main.swift b/Firestore/Example/SwiftBuildTest/main.swift index f62bf48..260735b 100644 --- a/Firestore/Example/SwiftBuildTest/main.swift +++ b/Firestore/Example/SwiftBuildTest/main.swift @@ -39,7 +39,7 @@ func main() { listenToDocuments(matching: query); - enableDisableNetwork(db: db); + enableDisableNetwork(database: db); types(); } @@ -133,7 +133,7 @@ func writeDocument(at docRef: DocumentReference) { } } -func enableDisableNetwork(db db: Firestore) { +func enableDisableNetwork(database db: Firestore) { // closure syntax db.disableNetwork(completion: { (error) in if let e = error { @@ -235,26 +235,27 @@ func readDocuments(matching query: Query) { func listenToDocument(at docRef: DocumentReference) { - let listener = docRef.addSnapshotListener() { document, error in - if let error = error { - print("Uh oh! Listen canceled: \(error)") - return - } + let listener = docRef.addSnapshotListener() { document, error in + if let error = error { + print("Uh oh! Listen canceled: \(error)") + return + } - if let document = document { - // Note that document.data() is nullable. - let data : [String:Any]? = document.data() - print("Current document: \(data)"); - if (document.metadata.isFromCache) { - print("From Cache") - } else { - print("From Server") - } - } + if let document = document { + // Note that document.data() is nullable. + if let data : [String:Any] = document.data() { + print("Current document: \(data)"); + } + if document.metadata.isFromCache { + print("From Cache") + } else { + print("From Server") + } } + } - // Unsubscribe. - listener.remove(); + // Unsubscribe. + listener.remove(); } func listenToDocuments(matching query: Query) { @@ -316,7 +317,7 @@ func transactions() { let balanceA = try transaction.getDocument(accA)["balance"] as! Double let balanceB = try transaction.getDocument(accB)["balance"] as! Double - if (balanceA < amount) { + if balanceA < amount { errorPointer?.pointee = NSError(domain: "Foo", code: 123, userInfo: nil) return nil } -- cgit v1.2.3