Key-Value Observing Done Right. Again.
May 21, 2010 04:36 PM
| Cocoa, Development, Mac
| Permalink
I love using KVO for all sorts of things: side-effect, flagging UI as dirty, resetting caches, …Writing the observeValueForKeyPath:ofObject:change:context: method has long since become tedious. So I created a TextExpander snippet to write it for me.Still, I don't quite like it relying of string comparisons (which I use for context). And I regularly find myself forgetting to unregister observers.Mike
Comments
HHAssociatedObjects
May 19, 2010 10:20 AM
| Cocoa, Development, Mac
| Permalink
Mac OS X 10.6 introduced associated objects by the means of objc_getAssociatedObject and objc_setAssociatedObject. These provide a very convenient method for attaching object values to random objects. Associated objects can conveniently share the lifespan of the object they are associated with.One situation where associated objects come in especially handy is when writing categories. Associated objets
HHAutoHidingWindow
May 5, 2010 10:06 PM
| Cocoa, Development, Mac
| Permalink
For the next version of HoudahSpot, I am implementing a window which docks to the side of the screen where it shows and hides as needed. After looking into several implementations, I came up with my own. Seeing this may come in handy to some, I'd like to share this bit of code with you.HHSlidingWindow allows for docking a window at an edge of the main screen. From there it may slide in and out of visibility.

