change from Java to Swift