Update code for new swift version