Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let serialQueue = DispatchQueue(label: "queue", qos: .utility)
- tableView.selectedRowIndexes.forEach { row in
- serialQueue.async {
- InitData.fetch("someUrl") { initData in
- let fileManager = FileManager()
- do {
- try fileManager.copyItem(atPath: "pathA", toPath: "pathB")
- }
- catch let error {
- print(error)
- }
- }
- }
- }
- tableView.selectedRowIndexes.forEach { row in
- serialQueue.async {
- InitData.fetch("someUrl") { initData in
- let fileManager = FileManager()
- let workItem = DispatchWorkItem {
- do {
- try fileManager.copyItem(atPath: "pathA", toPath: "pathB")
- }
- catch let error {
- print(error)
- }
- }
- DispatchQueue.global(qos: .background).async(execute: workItem)
- }
- }
- }
Add Comment
Please, Sign In to add comment