快速2到3迁移dispatch_get_global_queue [英] Swift 2 to 3 Migration dispatch_get_global_queue

查看:199
本文介绍了快速2到3迁移dispatch_get_global_queue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,我一直在尝试将它们从swift 2转换为swift 3.

I have the following code that I've been trying to translate into swift 3 from swift 2. Here is what I have so far.

DispatchQueue.async(group: DispatchQueue.global(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),execute: {
            self.controllerDelegate?.codeToRun(progressWindowViewController: self)
        })

我遇到一个错误,提示无法使用类型(int,int)的参数列表调用全局".我知道全局队列需要这个,除非他们迅速将其更改为3? 在Swift 3中执行全局队列的正确方法是什么?

I am getting an error that says Cannot invoke 'global' with an argument list of type (int,int). I know that the global queue needs this though unless they changed it in swift 3? What is the correct way to do global queues in Swift 3?

先前的Swift 2等效版本

Previous Swift 2 Equivlent

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),{
            self.controllerDelegate?.codeToRun(self)
        })

推荐答案

尝试一下即可.

DispatchQueue.global(qos: .background).async {

    DispatchQueue.main.async {

    }
})

如果您仍然需要任何帮助,请随时在这里询问.

If you still need any help feel free to ask here.

这篇关于快速2到3迁移dispatch_get_global_queue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆