Code converted for Swift 3.0.1 compatibility. I have not completed the entire chapter, but the example is working as described in the book.
// MARK: - NSTableViewDataSource
// original
func numberOfRowsInTableView( tableView: NSTableView) -> Int {
return voices.count }
// Swift 3.0.1
func numberOfRows(in tableView: NSTableView) -> Int {
return voices.count
}
// original
func tableView( tableView: NSTableView, objectValueForTableColumn tableColumn: NSTableColumn?, row: Int) -> AnyObject? {
let voice = voices[ row]
let voiceName = voiceNameForIdentifier( voice)
return voiceName
}
// Swift 3.0.1
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
let voice = voices[ row]
let voiceName = voiceNameForIdentifier( identifier: voice)
return voiceName as AnyObject?
}