2

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?

Shmidt
  • 16,436
  • 18
  • 88
  • 136

1 Answers1

2

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"
Kostiantyn Koval
  • 8,407
  • 1
  • 45
  • 58