duemunk / Async

Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch
MIT License
4.59k stars 316 forks source link

Migration to Swift 3.0 #86

Closed duemunk closed 8 years ago

duemunk commented 8 years ago

Public API changes

Custom queues

Async.customQueue(queue) {} to Async.custom(queue: queue) {} group.customQueue(customQueue) {} to group.custom(queue: customQueue) {}

Description property for DispatchQueue.GlobalAttributes

public extension DispatchQueue.GlobalAttributes {
  var description: String { get }
}

Internal changes

DispatchWorkItem

GCD now uses DispatchWorkItem item instead of dispatch_block_t. Functionality for notify(), wait() and cancel() are now all functions on DispatchWorkItem.

QOS

Quality of Service classes are a bit scattered now, but creating a queue looks like this:

// 2.2
let userInteractiveQueue: dispatch_queue_t = dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0)
// 3.0
let userInteractiveQueue: DispatchQueue = DispatchQueue.global(attributes: .qosUserInteractive)

Dispatch Apply – ⚠️not working ⚠️

For doing concurrent for loops, we used to be able to use dispatch_apply(iterations, queue) {} but the only API for doing it is DispatchQueue.concurrentPerform(iterations: Int) {} which is a class functions on DispatchQueue and doesn't take a queue parameter. This means we've currently lost the functionality.

JoshHrach commented 8 years ago

When are you planning to merge this?

duemunk commented 8 years ago

This has been done as of be84110aa5e7852c5e577d3bd6902177c6742512