-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement runTransaction and batch support #28
Conversation
@@ -34,6 +34,63 @@ extension Firestore { | |||
public func collection(_ collectionPath: String) -> CollectionReference { | |||
swift_firebase.swift_cxx_shims.firebase.firestore.firestore_collection(self, std.string(collectionPath)) | |||
} | |||
|
|||
public func runTransaction(_ updateBlock: @escaping (Transaction, UnsafePointer<NSError?>?) -> Any?, completion: @escaping (Any?, Error?) -> Void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this need changes from https://github.com/thebrowsercompany/swift-firebase/pull/30/files for the error pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that PR builds on top of this one. I wrote that one once I was able to try building against Arc. Rather than complicate things by folding it into this PR, I just left them as separate. Hope that works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good to me, had some questions around who maintains the reference to future, but otherwise LGTM
Adds:
Transaction
,TransactionOptions
andWriteBatch
typesVoidFuture
as workaround forFuture<void>
TransactionWeakReference
as a wrapper forTransaction
sinceTransaction
cannot be exposed directly to Swift given that it is a non-copyable type.