Guest User

Untitled

a guest
Jan 17th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. let serialQueue = DispatchQueue(label: "queue", qos: .utility)
  2.  
  3. tableView.selectedRowIndexes.forEach { row in
  4.  
  5. serialQueue.async {
  6.  
  7. InitData.fetch("someUrl") { initData in
  8. let fileManager = FileManager()
  9.  
  10. do {
  11. try fileManager.copyItem(atPath: "pathA", toPath: "pathB")
  12. }
  13. catch let error {
  14. print(error)
  15. }
  16. }
  17. }
  18. }
  19.  
  20. tableView.selectedRowIndexes.forEach { row in
  21.  
  22. serialQueue.async {
  23.  
  24. InitData.fetch("someUrl") { initData in
  25. let fileManager = FileManager()
  26. let workItem = DispatchWorkItem {
  27.  
  28. do {
  29. try fileManager.copyItem(atPath: "pathA", toPath: "pathB")
  30. }
  31. catch let error {
  32. print(error)
  33. }
  34. }
  35. DispatchQueue.global(qos: .background).async(execute: workItem)
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment