An infinite loop in swift can be created using a while loop with the condition set to true. Here is an example:
main.swift63 chars4 lines
In the above code, the loop will continue to run indefinitely as the condition true will always evaluate to true. It is important to include a way to exit from the loop such as using a break statement inside the loop.
gistlibby LogSnag