如何索引一个没有任何部分的 UITable

How to Index a UITable with no sections at all

可以(或不可能)索引没有任何部分的 table?

据我所知,swift 除了语法之外没有任何变化:

/* section headers
   appear above each `UITableView` section */
override func tableView(tableView: UITableView,
    titleForHeaderInSection section: Int)
    -> String {
    // do not display empty `Section`s
    if !self.sections[section].users.isEmpty {
        return self.collation.sectionTitles[section] as String
    }
    return ""
}

/* section index titles
   displayed to the right of the `UITableView` */
override func sectionIndexTitlesForTableView(tableView: UITableView)
    -> [AnyObject] {
    return self.collation.sectionIndexTitles
}

override func tableView(tableView: UITableView,
    sectionForSectionIndexTitle title: String,
    atIndex index: Int)
    -> Int {
    return self.collation.sectionForSectionIndexTitleAtIndex(index)
}

Full example here.