Porting to swift