Updated with the latest changes in Swift language.

Also made the sorting functions to return [Int].
Easier to test, and it clearly declares that it's a sorting of [Int] to a sorted [Int]