How to create dispatch queue in Swift 3

前端 未结 15 2089
余生分开走
余生分开走 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:26

    Compiled in XCode 8, Swift 3 https://github.com/rpthomas/Jedisware

     @IBAction func tap(_ sender: AnyObject) {
    
        let thisEmail = "emailaddress.com"
        let thisPassword = "myPassword" 
    
        DispatchQueue.global(qos: .background).async {
    
            // Validate user input
    
            let result = self.validate(thisEmail, password: thisPassword)
    
            // Go back to the main thread to update the UI
            DispatchQueue.main.async {
                if !result
                {
                    self.displayFailureAlert()
                }
    
            }
        }
    
    }
    

提交回复
热议问题