while

Swift's while loop functions much the same as it does in any language:

while limit > 0 
{
// doSomething()
limit -= 1
}

If you want the code to run first once, and then test a condition, use repeat:

repeat 
{
doSomethingRepetitive()
limit -= 1
}
while limit > 0

Between them, these two statements will cover the (usually infrequent) cases that are not covered by the enumeration loop statements.