0

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.

1
  • Oh I'm sorry I didn't see that - thank you :) Commented Sep 20, 2014 at 11:37

1 Answer 1

2

This implementation of sort should be what you are looking for:

array.sort({
    $0.name < $1.name
})
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.