Reputation: 16664
uniqueOrganizationsArray
is of [String]
type.
private let collation = UILocalizedIndexedCollation.currentCollation() as UILocalizedIndexedCollation
private var sections: [[String]] = []
let selector: Selector = ""
sections = [[String]](count: collation.sectionTitles.count, repeatedValue: [])
for object in uniqueOrganizationsArray {
let sectionNumber = collation.sectionForObject(object, collationStringSelector: selector)
sections[sectionNumber].append(object as String)
}
What selector should I use on String
object?
Upvotes: 2
Views: 471
Reputation: 8483
You can use self
or description
for String type. I prefer self
because it can be used with any types. When using self, you would compare objects itself
let selector: Selector = "self"
let selector: Selector = "description"
Upvotes: 2