Skip to content

Commit

Permalink
Implemented correct NSColorWell KVO.
Browse files Browse the repository at this point in the history
  • Loading branch information
will-lumley committed Feb 9, 2020
1 parent 50c1879 commit d80ec7f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Example/RichEditor/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ class ViewController: NSViewController

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?)
{
print("KeyPath: \(keyPath)")
print("Object: \(object)")
print("Change: \(change)")
print("Context: \(context)")

super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
//If our NSColorWell changed it's colour
if object as? NSColorWell == self.textColorWell && keyPath == "color" {
self.richEditor.apply(textColour: self.textColorWell.color)
}
}
}

Expand Down

0 comments on commit d80ec7f

Please sign in to comment.