DispatchQueue
extension DispatchQueue: Dispatcher
-
Undocumented
Declaration
Swift
public func dispatch(_ body: @escaping () -> Void)
-
Undocumented
Declaration
Swift
static var pmkDefault: DispatchQueue
-
Converts a
DispatchQueue
with given dispatching parameters into aDispatcher
Declaration
Swift
func asDispatcher(group: DispatchGroup? = nil, qos: DispatchQoS? = nil, flags: DispatchWorkItemFlags? = nil) -> Dispatcher
-
Asynchronously executes the provided closure on a dispatch queue, yielding a
Guarantee
.DispatchQueue.global().async(.promise) { md5(input) }.done { md5 in //… }
- _: Must be
.promise
to distinguish from standardDispatchQueue.async
- group: A
DispatchGroup
, as for standardDispatchQueue.async
- qos: A quality-of-service grade, as for standard
DispatchQueue.async
- flags: Work item flags, as for standard
DispatchQueue.async
- body: A closure that yields a value to resolve the guarantee.
Declaration
Swift
@available(macOS 10.10, iOS 2.0, tvOS 10.0, watchOS 2.0, *) final func async<T>(_: PMKNamespacer, group: DispatchGroup? = nil, qos: DispatchQoS? = nil, flags: DispatchWorkItemFlags? = nil, execute body: @escaping () -> T) -> Guarantee<T>
Return Value
A new
Guarantee
resolved by the result of the provided closure. - _: Must be
-
Asynchronously executes the provided closure on a dispatch queue, yielding a
Promise
.DispatchQueue.global().async(.promise) { try md5(input) }.done { md5 in //… }
Declaration
Swift
@available(macOS 10.10, iOS 8.0, tvOS 9.0, watchOS 2.0, *) final func async<T>(_: PMKNamespacer, group: DispatchGroup? = nil, qos: DispatchQoS? = nil, flags: DispatchWorkItemFlags? = nil, execute body: @escaping () throws -> T) -> Promise<T>
Parameters
_
Must be
.promise
to distinguish from standardDispatchQueue.async
group
A
DispatchGroup
, as for standardDispatchQueue.async
qos
A quality-of-service grade, as for standard
DispatchQueue.async
flags
Work item flags, as for standard
DispatchQueue.async
body
A closure that yields a value to resolve the promise.
Return Value
A new
Promise
resolved by the result of the provided closure.