In my NSCollectionViewItem
I set up a mouseDown function, that calls a setSelected()
function in the view.
override func mouseDown(with event: NSEvent) {
(self.view as! ListTableViewCell).setHighlighted(true, animated: true, completionHandler:{
print("completionHandler called")
self.delegate?.collectionViewItem(self, didSelectAtIndexPath: self.indexPath!)
super.mouseDown(with: event)
})
}
As you can see, in the completionHandler, I then call the delegate and tell it a cell has been selected. In that delegate function I then deselect the row.
override func tableView(_ tableView: AppTableView, didSelectRowAtIndexPath indexPath: IndexPath) {
print("didSelectRowAtIndexPath()")
tableView.deselectRow(at: indexPath, animated: true)
print(indexPath)
}
This code works, but when it is executed, it executes near instant making the backgroundColor change invisible. How can I animate this? Or slow it down? Or are there any other solutions?