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
| extension OperationQueue { | |
| /// Creates a debounced function that delays invoking `action` until after `delay` seconds have elapsed since the last time the debounced function was invoked. | |
| /// | |
| /// - Parameters: | |
| /// - delay: The number of seconds to delay. | |
| /// - underlyingQueue: An optional background queue to run the function | |
| /// - action: The function to debounce. | |
| /// - Returns: Returns the new debounced function. | |
| open class func debounce(delay: TimeInterval, underlyingQueue: DispatchQueue? = nil, action: @escaping () -> Void) -> (() -> Void) { |
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
| import Foundation | |
| import PlaygroundSupport | |
| /// A thread-safe array. | |
| public class SynchronizedArray<Element> { | |
| private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent) | |
| private var array = [Element]() | |
| public init() { } | |
OlderNewer