Added Swift code and tested