added example completely written in swift