ios - How to use dispatch queue for high Priority in background in Swift 3.1 -
let dict_one=result[i] let product:allproducts=allproducts() product.applications=dict_one.objectforkey("applications") as? string product.desc=dict_one.objectforkey("description") as? string product.familyid=string(dict_one.objectforkey("familyid") as! int) if dict_one.objectforkey("imagename") as? string != nil { product.imagename=dict_one.objectforkey("imagename") as? string let url:string = appconstant.getallimages + (dict_one.objectforkey("imagename") as? string)! dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0)) { let imagepath=self.fileindocumentsdirectory((dict_one.objectforkey("imagename") as? string)!) self.saveimage(url, image_name1: (dict_one.objectforkey("imagename") as? string)!,path: imagepath) } } else { product.imagename="" }
i need use dispatch queue high priority in background in swift 3.1 can find out solution?
here go:
dispatchqueue.global(qos: .userinitiated).async { //your code goes here //coming main queue update ui dispatchqueue.main.async { //update ui (reloading tableview, label update, etc. here) } }
hope helps.
Comments
Post a Comment