Questions tagged [blockoperation]

The BlockOperation class is a concrete subclass of Operation that manages the concurrent execution of one or more blocks in Swift language by Apple. You can use this object to execute several blocks at once without having to create separate operation objects for each. When executing more than one block, the operation itself is considered finished only when all blocks have finished executing.

The BlockOperation class is a concrete subclass of Operation that manages the concurrent execution of one or more blocks. You can use this object to execute several blocks at once without having to create separate operation objects for each. When executing more than one block, the operation itself is considered finished only when all blocks have finished executing.

Blocks added to a block operation are dispatched with default priority to an appropriate work queue. The blocks themselves should not make any assumptions about the configuration of their execution environment.

3 questions
3
votes
1 answer

start() for BlockOperation on the main thread

Why is calling start() for BlockOperation with more then 1 block on a main thread not calling its block on the main thread? My first test is always passed but second not every time - some times blocks executes not on the main thread func…
1
vote
2 answers

Updating UI when working with OperationQueue

I have an operation queue setup as follows: let queue = OperationQueue() queue.name = "com.company.myQueue" queue.qualityOfService = .userInitiated queue.maxConcurrentOperationCount = 64 ... var current = 0 var totalCount = someArray.count for i in…
Joseph
  • 9,171
  • 8
  • 41
  • 67
0
votes
1 answer

Adding dependency of one BlockOperation on another is not working properly in swift

I have multiple api's in a controller and after successful response I have to reload the UITableView. For now I started with two api having second api dependency on first one using BlockOperation and DispatchGroup in it. First in viewDidLoad:…
Amit
  • 4,837
  • 5
  • 31
  • 46