在 swift 中翻译 dispatch_async

translate dispatch_async in swift

我正在尝试将下面的 objective c 代码翻译成 swift,到目前为止我已经这样做了,但是我遇到了一些错误。感谢任何帮助。

 dispatch_async(dispatch_get_main_queue(), ^{
        [self.window.rootViewController presentViewController:self.incomingCall animated:YES completion:nil];

在 swift 版本中我是这样操作的,但出现错误:

dispatch_async(dispatch_get_main_queue(), { () -> Void in
            // Show the alert
           self.window?.rootViewController?.present(self.iincomingCall(), animated: true, completion: nil)
        })

swift3 语法是

DispatchQueue.main.async {
      //your code
 }