import Foundation class ImplementationTest { var data:[String: Any] = [:] func properties() { let group = DispatchGroup() group.enter() /// In the real code, an async operation is called which returns a value, that value is used to update the dictionary self.data.updateValue(true, forKey: "my_wonderful_key") group.leave() /// Same as above self.data.updateValue(true, forKey: "my_wonderful_key_2") group.leave() group.notify(queue: DispatchQueue.main, work: DispatchWorkItem(block: { print("Yay. Operation completed!") })) } }