Example implementation of promises in Swift