ios - 如何将 "dispatch_get_main_queue()"分配给 Swift 中的常量?

标签 ios swift dispatch-async

无法获得线索 - 如何在 Swift 中将“dispatch_get_main_queue()”分配给常量?

例如在 Objective-C 中它看起来如下:

#define kMainQueue dispatch_get_main_queue()

在这种情况下我应该使用 typealias 还是其他? 谢谢

最佳答案

你是这个意思吗?

let kMainQueue = dispatch_get_main_queue()

kMainQueue 是常量,这要归功于 let

关于ios - 如何将 "dispatch_get_main_queue()"分配给 Swift 中的常量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34539898/

相关文章:

ios - 使用 AirPrint 在连续纸卷上打印时出现不需要的额外空白空间

ios - 从不兼容类型 'CGPoint' 分配给 'struct CGPoint'(又名 'id')

ios - swift 从不同的 Storyboard 中移动另一个 ViewController

ios - swift 3 : URL Image makes UITableView scroll slow issue

ios - 在 tableView 底部按 "back"时导航 Controller 崩溃。如果我稍微向上滚动程序不会崩溃

ios - backgroundTimeRemaining 返回(35791394 分钟)?

html - 使用 Swift 从网站解析表格数据

swift - 只读属性

swift3 - 长循环 block 应用

ios - 崩溃 : com. apple.root.default-qos