Before the update I this code worked fine:
var alphabetizedArray = [[Person]]()
let collation = UILocalizedIndexedCollation()
for person : Person in ContactsManager.sharedManager.contactList {
var index = 0
if ContactsManager.sharedManager.sortOrder == .FamilyName {
index = collation.sectionForObject(person, collationStringSelector: "lastName")
}
else {
index = collation.sectionForObject(person, collationStringSelector: "firstName")
}
alphabetizedArray.addObject(person, toSubarrayAtIndex: index)
}
But now since string literal selectors are no longer alowed the code broke.
I tried to change string literal selector to Selector("lastName"), but the 'index' is always returned as -1. And I don't see any solution.
This collation method takes a property name of the given object. And Person class is really have those properties (lastName, firstName).
But how can I get this work again? Experiments with #selector gave me nothing: 'Argument of '#selector' does not refer to an initializer or method' it says. No wonder since this sectionForObject(, collationStringSelector:) takes no methods but a property names.