Last active
May 26, 2019 20:49
-
-
Save Mreyna3/e5e79b8159f2bda3d8d2c0516e7d23a0 to your computer and use it in GitHub Desktop.
addToBatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func addToBatch(transaction: Double) { | |
// 1 | |
queue.enqueue(element: transaction) | |
//2 | |
batchSum += transaction | |
if(shouldProcessBatch()){ | |
// 3 | |
processBatch() | |
}else{ | |
// 4 | |
defaults.set(batchSum, forKey: "batch_sum") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment