Matt Gallagher: Cocoa with Love

Articles about Swift, Cocoa, software design and programming.

  • Aug 2, 2008

    Objective-C era

    String philosophies: char arrays, std::string and NSString

    Each of the major C variants on the Mac implement character strings in their own way. It is fairly easy to learn the syntax differences between them but a simple API Reference doesn't explain the reasons for implementations: the different philosophies behind the implementations. In this post, I'll go past the 'How' of string differences and instead explain the 'Why' of differences between the three string implementations.

    Read article

  • Jul 27, 2008

    Objective-C era

    Key Value Information

    NSKeyValueCoding is used throughout Cocoa (Bindings, Core Data, Collections and more) but despite being a dynamic way of connecting to an object, it doesn't provide dynamic information about its own operation — which keys an object supports or the custom methods used to get and set values. This post will look at how NSKeyValueCoding works and show you how to get supported keys and their methods for any class or object.

    Read article

  • Jul 21, 2008

    Objective-C era

    Better integration for NSViewController and NSView

    NSViewController simplifies loading an NSView from a NIB file. But it has some limitations compared to NSWindowController (its window loading/managing equivalent). In this post, I'll explain the limitations and present options for overcoming them.

    Read article

  • Jul 6, 2008

    Objective-C era

    NSMapTable: more than an NSDictionary for weak pointers

    NSMapTable is collection class that was introduced in Mac OS X 10.5 (Leopard). At first glance, it would appear to be most useful as an NSDictionary replacement that can choose between "strong" and "weak" pointers. In this post, I'll show you why it is also useful outside garbage collection and how it can do things that NSDictionary can't (or shouldn't) do.

    Read article

  • May 24, 2008

    Objective-C era

    Adapter interfaces in Objective-C, using categories.

    The Categories feature of Objective-C lets the programmer add extra sets of methods after compilation, something impossible in most compiled languages. Using this feature, here is an Objective-C variant of the classic "Adapter" design pattern that allows two classes to work closely together, without two-way coupling dependency problems.

    Read article