I'm trying to update my object count using a runTransaction block, but the FIRMutable data returned is always (null).
If I enable persistence on FirebaseDatabase, it works, however I don't want to have it enabled.
let artworkRef = FIRDatabase.database().reference().child(doodlesKey).child(artwork.uid)
artworkRef.runTransactionBlock { (mutableData) -> FIRTransactionResult in
if var artworkData = mutableData.value as? [String: AnyObject] {
var bookmarkCount = artworkData["bookmarkCount"] as? Int ?? 0
bookmarkCount += 1
artworkData["bookmarkCount"] = bookmarkCount
mutableData.value = artworkData
return FIRTransactionResult.successWithValue(mutableData)
}
return FIRTransactionResult.successWithValue(mutableData)
}