simple promise implementation in swift