Seções alfabéticas na exibição de tabela em rápido

Eu tenho uma lista de nomes classificados em ordem alfabética e agora quero exibir esses nomes em uma exibição de tabela. Estou lutando para agrupar esses nomes para cada letra.

Meu código fica assim:

let sections:Array<AnyObject> = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
var usernames = [String]()

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{

    let cellID = "cell"

    let cell: UITableViewCell = self.tv.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell

    cell.textLabel?.text = usernames[indexPath.row]

return cell
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{

    return usernames.count
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int{

    return 26
}


func sectionIndexTitlesForTableView(tableView: UITableView) -> [AnyObject]!{

    return self.sections
}

func tableView(tableView: UITableView,
    sectionForSectionIndexTitle title: String,
    atIndex index: Int) -> Int{

        return index
}

func tableView(tableView: UITableView,
    titleForHeaderInSection section: Int) -> String?{

        return self.sections[section] as? String
}

e tudo funciona muito bem, exceto pelo agrupamento que faz com que minha visualização da tabela termine assim:

Portanto, eu sei que você deve poder usar a função filtrada em uma matriz, mas não entendi como implementá-la.

Todas as sugestões sobre como proceder serão apreciadas.

questionAnswers(6)

yourAnswerToTheQuestion