How to create dispatch queue in Swift 3

前端 未结 15 1914
余生分开走
余生分开走 2020-11-22 16:35

In Swift 2, I was able to create queue with the following code:

let concurrentQueue = dispatch_queue_create(\"com.swift3.imageQueue\", DISPATCH_QUEUE_CONCURR         


        
15条回答
  •  悲哀的现实
    2020-11-22 17:25

    You can create dispatch queue using this code in swift 3.0

    DispatchQueue.main.async
     {
       /*Write your code here*/
     }
    
       /* or */
    
    let delayTime = DispatchTime.now() + Double(Int64(0.5 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)                   
    DispatchQueue.main.asyncAfter(deadline: delayTime)
    {
      /*Write your code here*/
    }
    

提交回复
热议问题