Updated swift code to last version of the language