If I have an NSArray (or mutable array) with several dictionary objects (each dictionary is a Person) like this:
[
{ forename: chris, surname: smith, age: 22 }
{ forename: paul, surname: smith, age: 24 }
{ forename: dave, surname: jones, age: 21 }
{ forename: alan, surname: jones, age: 26 }
{ forename: cecil, surname: reeves, age: 32 }
{ forename: pablo, surname: sanchez, age: 42 }
]
How would I separate it into an array of four arrays, sorted by surname (and within that forename), like so:
[
[
{ forename: alan, surname: jones, age: 26 }
{ forename: dave, surname: jones, age: 21 }
]
[
{ forename: cecil, surname: reeves, age: 32 }
]
[
{ forename: pablo, surname: sanchez, age: 42 }
]
[
{ forename: chris, surname: smith, age: 22 }
{ forename: paul, surname: smith, age: 24 }
]
]