Skip to content

Commit

Permalink
Add support for calling the two-arg variant of runTransaction (#38)
Browse files Browse the repository at this point in the history
When given a first argument closure that returns a non-optional type,
the compiler would give up trying to match against the two-arg variant
and instead complain about the first argument missing a `with:` label
and not being a `TransactionOption` type.

A fix for this is to provide optional and non-optional variants of
the two arg override.
  • Loading branch information
darinf authored Feb 26, 2024
1 parent 6614e1f commit 54200eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/FirebaseFirestore/Firestore+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ extension Firestore {
swift_firebase.swift_cxx_shims.firebase.firestore.firestore_collection(self, std.string(collectionPath))
}

public func runTransaction(_ updateBlock: @escaping (Transaction, NSErrorPointer) -> Any, completion: @escaping (Any?, Error?) -> Void) {
runTransaction(with: nil, block: updateBlock, completion: completion)
}

public func runTransaction(_ updateBlock: @escaping (Transaction, NSErrorPointer) -> Any?, completion: @escaping (Any?, Error?) -> Void) {
runTransaction(with: nil, block: updateBlock, completion: completion)
}
Expand Down

0 comments on commit 54200eb

Please sign in to comment.