Search code examples
iosswiftdispatch-async

How to assign "dispatch_get_main_queue()" to a constant in Swift?


Can't get a clue - how to assign "dispatch_get_main_queue()" to a constant in Swift?

For example in Objective-C it looks following:

#define kMainQueue dispatch_get_main_queue()

Should I use typealias in this case, or smth else? Thank you


Solution

  • Do you mean this?

    let kMainQueue = dispatch_get_main_queue()
    

    kMainQueue is a constant thanks to the let