While AsyncGroup currently supports calling wait(), that doesn't always work when dealing with a group. An example is trying to call a series of nested functions that eventually perform an asynchronous network call. The group seems to finish, but it appears to complete immediately, leading to no action within the async method and no actual 'waiting'. Thus, if you were performing a segue after waiting and were setting up data for the segue in the group, the segue would complete without any of the data actually being passed along.
Creating a dispatch_group_notify call lets you wait until something is done and calling the action that needs to be done after the group is complete. For instance, you can create a group that calls various async methods within the group and trigger a segue after the group has completed its tasks.
I created this in the AsyncGroup struct. notify() is private and called by public notify() functions. For my purposes, I'm only calling items on the main thread in this response, so notifyMain is what I need. But if you want to trigger something in another queue, you can do so.
While AsyncGroup currently supports calling wait(), that doesn't always work when dealing with a group. An example is trying to call a series of nested functions that eventually perform an asynchronous network call. The group seems to finish, but it appears to complete immediately, leading to no action within the async method and no actual 'waiting'. Thus, if you were performing a segue after waiting and were setting up data for the segue in the group, the segue would complete without any of the data actually being passed along.
Creating a dispatch_group_notify call lets you wait until something is done and calling the action that needs to be done after the group is complete. For instance, you can create a group that calls various async methods within the group and trigger a segue after the group has completed its tasks.
I created this in the AsyncGroup struct. notify() is private and called by public notify() functions. For my purposes, I'm only calling items on the main thread in this response, so notifyMain is what I need. But if you want to trigger something in another queue, you can do so.