Matt Gallagher: Cocoa with Love

Articles about Swift, Cocoa, software design and programming.

  • May 4, 2009

    Objective-C era

    Invoking other processes in Cocoa

    Invoking other processes is a good way to handle some low-level tasks on the Mac. I'll show you some simple ways to invoke processes and parse their outputs in Cocoa apps as well as some advanced tricks like running a process with administrator privileges.

    Read article

  • Apr 28, 2009

    Objective-C era

    Easy custom UITableView drawing

    It is really easy to customize your UITableViews. I'll show you how to completely customize the appearance of UITableViews without overriding or subclassing and without the need for any tricky hackery.

    Read article

  • Apr 18, 2009

    Objective-C era

    What does it mean when you assign [super init] to self?

    One of the strangest pieces of common syntax in Objective-C is the line self = [super init];. Without any explanation, this arrangement raises a few questions. Does this line set the self value for the instance? Is self just a variable like any other? If so, why have it at all? I'll address each of these questions and show how the compiler converts uses of self and method invocations.

    Read article

  • Apr 12, 2009

    Objective-C era

    Showing a "Loading..." message over the iPhone keyboard

    The "Text" (SMS) application on the iPhone uses a custom, semi-transparent view to show its "Sending..." message over the keyboard. I'll show you a simple class that can display semi-transparent loading messages and how you can display messages over the keyboard.

    Read article

  • Apr 5, 2009

    Objective-C era

    8 Confusing Objective-C Warnings and Errors

    Objective-C's unique syntax results in unique ways of making mistakes. In this post, I look at the compiler warnings and errors GCC outputs when you make mistakes or potential mistakes in your Objective-C syntax and show you how to fix them.

    Read article

  • Mar 28, 2009

    Objective-C era

    Using NSKeyedArchiver to archive a C linked-list

    NSKeyedArchiver provides some support for archiving C primitive types but provides no support for pointers to C structs. I'll show you how you can archive a linked list of C structs, despite the lack of support in NSKeyedArchiver.

    Read article

  • Mar 22, 2009

    Objective-C era

    Recreating UITableViewController to increase code reuse

    UITableViewController and UIViewController are the two most commonly implemented controllers on the iPhone. It may not always be clear what UITableViewController adds to its superclass. I'll show you what UITableViewController does by recreating its functionality on top of UIViewController and show you why doing this can provide a richer base controller class that you can use throughout your iPhone application.

    Read article

  • Mar 13, 2009

    Objective-C era

    Scripted window management in Xcode

    Xcode's placement of windows and views has never entirely satisfied me. In this post, I'll show you a series of Applescripts that I use to create my own arrangement of Xcode windows so that I can choose where different kinds of documents are placed and reorganize the layout of windows with basic key commands.

    Read article

  • Mar 8, 2009

    Objective-C era

    An Asteroids-style game in CoreAnimation, Part Four.

    Over the last three weeks, I presented a simple 2D game using CoreAnimation. For the final post in this series, I'll look at CATransactions and why I didn't use them in the game to handle animations and I'll look at the performance of CoreAnimation as numbers of CALayers and sizes of CALayers change.

    Read article

  • Mar 1, 2009

    Objective-C era

    An Asteroids-style game in CoreAnimation, Part Three.

    How would you write an arcade-style 2D game in CoreAnimation? I'll show you how to write a resolution independent, high-speed, model-view-controller designed, Asteroids-style arcade game using CoreAnimation as the screen renderer. In this third of four parts, I add the logic for the game and game objects and present the finished code for the project.

    Read article