added custom `while` in Swift