Swift meetup

itscoderslife

Coder

Posted on April 11, 2018

Swift meetup

After a long time attended a meetup. And this was on the topic which I work on day to day – Swift programming language.

The meetup overall was good. Got to learn couple of new things – DispatchGroups, Swift Runtime and the thing that we can have our own Swift’s virtual environment just like virtualenv in Python, for swift its called virtualswift.

The most useful talk for me was on measuring performance in swift by Mayur Dhaka in which I can use immediately is DispatchGroups.

DispatchGroup primarily avoids the code shifting to right while using nested blocks like completion handlers.

From what I understood is DispatchGroups are the thing which can be used to group a logical set of background operations into one unit. It has very few APIs. According to Apple :

DispatchGroup().enter() – to indicate the block has entered the group.

DispatchGroup().leave() – to indicate the block in the group has completed.

DispatchGroup().notify(...) – to schedule a block or a work item to be submitted to a queue when a group of previously submitted block objects have completed.

DispatchGroup().wait(...) – waits synchronously for the previously submitted work to complete.

Basically DispatchGroup is to synchronize and track a set of tasks which are logically grouped and executed according to your requirements.

Hope this gist will help you get to know something new and explore more if interested.

swift-small

💖 💪 🙅 🚩
itscoderslife
Coder

Posted on April 11, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Swift meetup
appdev Swift meetup

April 11, 2018