Skip to content

Instantly share code, notes, and snippets.

@danielmartin
Created November 18, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmartin/a6964e88cf59ba8ac334a3aa4bf3d03f to your computer and use it in GitHub Desktop.
Save danielmartin/a6964e88cf59ba8ac334a3aa4bf3d03f to your computer and use it in GitHub Desktop.
Simple way to sort an Array in Swift
import Foundation
let sample = [11, 57, 55, 37, 54, 41, 30, 8, 53, 4, 47, 58, 18, 56, 17, 12, 39, 28, 16, 63, 40, 27, 50, 48, 19, 2, 25, 52, 13, 59, 64, 9, 26, 24, 23, 44, 21, 0, 6, 62, 61, 7, 29, 43, 38, 33, 51, 34, 3, 42, 22, 46, 5, 1, 10, 32, 60, 15, 49, 45, 35, 20, 36, 31]
sample.sort {
return $0 < $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment