Created
June 12, 2020 08:13
-
-
Save stevencurtis/6f6f9e9a744267dd64d6186dded79a44 to your computer and use it in GitHub Desktop.
queuemanager
This file contains 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
class QueueManager { | |
/// The Lazily-instantiated queue | |
lazy var queue: OperationQueue = { | |
let queue = OperationQueue() | |
return queue; | |
}() | |
/// The Singleton Instance | |
static let sharedInstance = QueueManager() | |
/// Add a single operation | |
/// - Parameter operation: The operation to be added | |
func enqueue(_ operation: Operation) { | |
queue.addOperation(operation) | |
} | |
/// Add an array of operations | |
/// - Parameter operations: The Array of Operation to be added | |
func addOperations(_ operations: [Operation]) { | |
queue.addOperations(operations, waitUntilFinished: true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment