我正在尝试将Objective_C的dispatch_time转换为swift,但出现此错误:
if !(hasPresented != nil){
let vc: TutorialInfoViewController = self.storyboard?.instantiateViewControllerWithIdentifier("TutorialInfoViewController") as! TutorialInfoViewController
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue()) {
presentViewController(vc, animated: true, completion: nil)
}
}
最佳答案
试试这个。这对我有用
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(Double(NSEC_PER_SEC) * 2)), dispatch_get_main_queue(), { () -> Void in
ptintln("it works!")
})