NSTableview set selectionHighlightStyle to NSTableViewSelectionHighlightStyleNone programmatically in Swift

529 views Asked by At

If I selected a row, I want to disable the highlighting blue color. In Swift language, I'm unable to set selectionHighlightStyle to NSTableViewSelectionHighlightStyleNone for my NSTableview.

This is my code:

func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {

    let cellView: NSTableCellView = tableView.makeViewWithIdentifier(tableColumn!.identifier, owner: self) as! NSTableCellView

    tableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone // error statement "Use of unresolved identifier 'NSTableViewSelectionHighlightStyleNone'"

    return cellView
}

For the statement tableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone it is throwing an error 'Use of unresolved identifier 'NSTableViewSelectionHighlightStyleNone'.

1

There are 1 answers

0
Lubos On BEST ANSWER

Please change your code as following to make it compilable in Swift:

tableView.selectionHighlightStyle = .None