Swift how to sort array of custom objects by property value
lets say we have a custom class named imageFile and this class contains two properties.
class imageFile {
var fileName = String()
var fileID = Int()
}
lots of them stored in Array
var images : Array = []
var aImage = imageFile()
aImage.fileName = "image1.png"
aImage.fileID = 101
images.append(aImage)
aImage = imageFile()
aImage.fileName = "image1.png"
aImage.fileID = 202
images.append(aImage)
question is: how can i sort images array by 'fileID' ASC or DESC?