Thanks to the comments above, I was able to get this to work
....runTransactionBlock { (currentData: FIRMutableData) -> FIRTransactionResult in var value = currentData.value as? Int if value == nil { value = 0 } currentData.value = value! + 1 return FIRTransactionResult.successWithValue(currentData) }
source share