Re: Return from a background queue

2015-12-22 Thread Roland King
You can’t do what you’re trying to do. First off, a block (which is what dispatch_async() takes) is defined to take no parameters and return nothing. That’s the source of your compilation error, you’re trying to return something from a block defined not to return anything. Secondly, what

Return from a background queue

2015-12-22 Thread Eric E. Dolecki
I am trying to return a dictionary from a method that uses a queue. I'm not sure how to actually return though as I get an error (can't convert value of type '() -> Dictionary' to expected argument type 'dispatch_block_t'. I've tried a number of things but none prevent an error

Re: Return from a background queue

2015-12-22 Thread Glenn L. Austin
The problem is that you need to return SOMETHING from getForecast -- right now you're returning nothing. The task will execute at some point "in the future" after the routine ends. An "easy" solution is to pass a closure to getForecast that will take a Dictionary? as a parameter (just in