1

in swift if a long running throwing function is called from the main thread will I be blocking my UI? Or do throwing functions occur asynchronously automatically? Just wondering if I should dispatch it off the main thread or if that will be redundant.

alionthego
  • 8,508
  • 9
  • 52
  • 125

1 Answers1

1

The function will run on which ever queue you call it on. If it is a long running function as you say I would suggest firing it off on a background queue so that you don't risk it tying up your main queue.

If you would like more background info (pun intended) checkout Objc.IO article Concurrency APIs on OS X and iOS

This diagram is from the article and quite useful for visualizing queues. enter image description here

Peter Hornsby
  • 4,208
  • 1
  • 25
  • 44