I want to run some code in withExclusiveControl and only when the downloads count is 0
Approach 1
manager.fetchCurrentDownloads { downloads, e in
manager.withExclusiveControl { a, e in
// Here we are in ExclusiveControl but checking for downloads.count == 0 might not give accurate value
}
}
Approach 2
manager.withExclusiveControl { a, e in
manager.fetchCurrentDownloads { downloads, e in
// Here we can check for downloads.count == 0, but not actually in ExclusiveControl
}
}
Can you please let me know how to achieve this?