Are we (NSViewController view) the First Responder?

In some cases a class may want to know if it’s the first responder before triggering an action. For instance if several loaded View Controller classes are listening for the same notification, how can they know which one should trigger the action? Well… they should ask their view.  In this case a NSTableView class is …

Copy one or multiple NSTableView rows, Swift

So here’s a simple yet tricky one: you’ve created your NSTableView but now you would like to allow a user to copy to the clipboard one, or a couple of rows. How do you do it? 1. Implement the function copy (func copy(sender: AnyObject?){}), do not confuse with the method for duplicating an object.   2. Get the …

Using NSValueTransformers (Value Transformer) Swift 2.0

So here’s a tricky one, on my upcoming app I sometimes use View-Based TableViews. Mostly, it works like magic, but sometimes you need to use a Value Transformer in the binding to allow the table to understand how to display something. In this example, I needed to convert a NSNumber to a String (and back!). Here’s …