Matt Gallagher: Cocoa with Love

Articles about Swift, Cocoa, software design and programming.

  • May 25, 2010

    Objective-C era

    Handling unhandled exceptions and signals

    When an application crashes on the iPhone, it disappears without telling the user what happened. However, it is possible to add exception and signal handling to your applications so that an error message can be displayed to the user or you can save changes. It is even possible to try to recover from this situation without crashing at all.

    Read article

  • May 17, 2010

    Objective-C era

    5 ways to draw a 2D shape with a hole in CoreGraphics

    In this post, I look at 5 different ways that you can draw a very simple shape: a square with a triangular hole cut out of the center. In a drawing environment like CoreGraphics which offers double buffering, winding count path filling, even-odd path filling and clipping regions, there's no single answer. An iPhone sample project is provided containing the code but all drawing functions are identical on the Mac.

    Read article

  • May 12, 2010

    Objective-C era

    A look at how malloc works on the Mac

    In this post, I'll take a high-level look at how malloc is implemented on the Mac. I'll look at how memory is allocated for "tiny", "small" and "large" allocation scales, the multi-core performance improvements introduced in Snow Leopard and some inbuilt debugging features you can trigger for finding memory problems including buffer overruns.

    Read article

  • May 6, 2010

    Objective-C era

    Finding or creating the application support directory

    A simple post this week but one which optimizes a common task: locating the application support directory for the current application, creating it if it doesn't exist. The result makes accessing the current application's support directory a single line and provides a structure for locating and creating folders at other standard locations with similar ease.

    Read article

  • Apr 27, 2010

    Objective-C era

    Porting a Mac program to Windows using The Cocotron

    In this last of three posts about porting a Mac application to Windows, I look at the steps involved in setting up The Cocotron with a remote debugging session between Xcode and the application running on Windows. I'll also talk about the code that didn't "just work" and some of the approaches I used to fix the program and get it working.

    Read article

  • Apr 21, 2010

    Objective-C era

    Design of a multi-platform app using The Cocotron

    In this post, I'll talk about how multi-platform applications are structured and talk about some of the different ways that applications separate core logic from platform specific behaviors. I'll talk about how using a porting layer like The Cocotron fits into these designs and why using The Cocotron doesn't necessarily mean that you're ignoring best-practice or creating a second-class application.

    Read article

  • Apr 15, 2010

    Objective-C era

    Options for porting Objective-C/Cocoa apps to Windows

    There are a few different options for porting Objective-C/Cocoa applications to Windows. Each option has different advantages and offers different capabilities. In this post, I'll give an overview of some of these options, their advantages and disadvantages.

    Read article

  • Apr 7, 2010

    Objective-C era

    Network data requirements on iPhone OS devices

    If your iPhone OS application makes heavy use of the network, there are a few extra settings your application will require to ensure the network works correctly and Apple will approve your application. These requirements are not always obvious (some are documented, others are only implied in documentation). I thought I'd share them so that you can avoid network dropouts and unnecessary App Store rejections.

    Read article

  • Mar 29, 2010

    Objective-C era

    Streaming MP3/AAC audio again

    This week I present some further additions to AudioStreamer, a class I first presented in Streaming and playing an MP3 stream and revisited with bug fixes in Revisiting an old post: Streaming and playing an MP3 stream. This time, I'll add the two of the most requested features: seeking and HE-AAC audio support.

    Read article