p-sun / ios_concurrency

Grand central dispatch experiments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swift iOS Concurrency

Grand central dispatch examples to validate the developer's understanding. The app includes different combinations of async, sync, serial, concurrent, DispatchQueue.main, DispatchQueue.global(), etc...

Emojis make it easy to visually scan the logs to see which work item occurred on which thread. In each example:

  • Each work item is maked with a different fruit emoji. e.g. 🍊,🫐,πŸ₯, or πŸ‡.
  • Each work item is preceeded by a number indicating the order it occurs. e.g. "(4) 🍊"
  • Each thread number is hashed to a combination of one or two squares. e.g. Main thread 1 is always πŸŸ₯, thread 6 is always 🟧, thread 15 is always ⬜️πŸŸͺ, etc...

Sync and async in a concurrent queue

Press the button to run this example. Note the code and the logs.

Screenshot 2023-09-16 at 1 42 25 PM

Video Sample

iOS.Concurrency.Examples.mov

About

Grand central dispatch experiments.

License:MIT License


Languages

Language:Swift 100.0%