Here's an implementation of bubble sort in Swift:
main.swift349 chars15 linesTo use this function, you would simply call it like so:
main.swift95 chars4 linesNote that the array parameter is marked as inout, which means that the function can modify the array in place. This is necessary for bubble sort since it involves swapping elements in the array.
gistlibby LogSnag