Reputation: 7731
The headers say dispatch_get_global_queue
returns global queue
or NULL
.
* @result
* Returns the requested global queue or NULL if the requested global queue
* does not exist.
*/
@available(OSX 10.6, *)
@warn_unused_result
public func dispatch_get_global_queue(identifier: Int, _ flags: UInt) -> dispatch_queue_t!
Why is the return value dispatch_queue_t!
instead of optional dispatch_queue_t?
Upvotes: 3
Views: 176
Reputation: 437872
The dispatch_queue_t!
is an optional, but it's an implicitly unwrapped one (saving you from having to manually unwrap it every time you use it).
When you see implicitly unwrapped optionals in Cocoa APIs, sometimes it just means that they haven't yet audited that particular API for nullability. Or perhaps they just wanted to save you from having to manually unwrap the optional yourself. Or perhaps it's an artifact that GCD objects employ a non-standard interface (it returns ARC-compatible objects but doesn't use the usual Objective-C *
object references), so maybe the Swift bridging can't handle it gracefully.
Upvotes: 4