I have an Array called "myArray". In this array I have several objects from a custom NSObject class where I have 2 properties named "name" and "age". Now I want to sort the objects in the Array in alphabetic order by the property "name". I know how to do this in Objective-C but I really don't have an idea how to do this in Swift. Would be great if someone could help me.
Asked
Active
Viewed 2,895 times
0
-
Oh I'm sorry I didn't see that - thank you :) – borchero Sep 20 '14 at 11:37
1 Answers
2
This implementation of sort should be what you are looking for:
array.sort({
$0.name < $1.name
})

erdekhayser
- 6,537
- 2
- 37
- 69