Archive for the ‘Cocoa’ Category

Doc-based Application Xcode Project Template

Thursday, December 3rd, 2009

Just started a collection of Xcode file and project templates on bitbucket.org.

The big feature of the collection is a project template for a document-based Cocoa application with explicit NSWindowControllers.  This project illustrates using the Cocoa document architecture to implement an explicitly managed main window and an associated inspector window.

Download a zip archive of the project template here.

SOLogger: a Cocoa ASL Logging framework

Wednesday, August 19th, 2009

I spent some time recently putting together a Cocoa interface to the built-in Apple System Logging (ASL) facility.

Following Peter Hosey’s excellent blog series on ASL and some other tidbits on Cocoa-Dev, I fashioned small and simple Cocoa framework for integrating ASL’s multi-leveled logging into your project.


#import <SOLogger/SOLogger.h>

SOLogger *logger;

logger = [SOLogger loggerForFacility: @"com.example.MyApp" options:ASL_OPT_STDERR];

[logger debug:@"A debugging note on: %@", [NSDate date]];

[logger info:@"We just did something."];
[logger notice:@"That's going to leave a mark"];
[logger warning:@"WTF?"];
[logger alert:@"WTF!"];
[logger critical:@"OMG"];
[logger panic:@"OMG WTF!"];

An interesting feature of SOLogger (courtesy of ASL) is that you can create separate loggers for subsystems in your code, potentially logging them to separate destinations.

I host the SOLogger project on Bitbucket with a BSD License.

Check it out.

Running selected unit tests with GHUnit

Saturday, March 14th, 2009

I love the sanity that GHUnit brings to running and debugging unit tests. The under-documented Xcode 3 mojo needed to configure SenTest unit test bundles for debugging throws a wet towel on the practice of test-driven Cocoa development.

The current GHUnit distribution runs all unit tests found in your app or framework. I did some work today to enable running a selected test cases and individual unit tests.

This works similarly to the SenTestingKit’s otest tool. You specify a unit test case and/or test name to run as an argument to the GHUnit test application.

In the Xcode’s executable panel for the test application, add arguments of the form:

-Test UserTests
-Test UserTests/testEmptyUserName
-Test All

When you run or debug the test app, only the specified test case or individual test will be executed. The argument -Test All will run all available unit test cases.

The patch file is here and works for Mac OS X. To apply the patch:

$ cd your-GHUnit-project-directory
$ patch -p1 < path-to-patch-file

I’ve submitted the patch to Gabriel, so maybe it’ll make it into a future release.

cocoawithlove.com

Saturday, August 2nd, 2008

[MattGallagher programming:Cocoa with:Love] is one of my new favorite Cocoa blogs.  I discovered it through Planet Cocoa, so thanks for that.

Matt writes at a sweet spot of Cocoa geekness style that I find really appealing.  He uses code recipes balanced with concise commentary to pack a lot of goodness into a tight blog posting.  I want my blog articles to read like his.

Implementing the reflection effect on images

Saturday, August 2nd, 2008

bithaus blogs about a category on NSImageView to do the reflection effect.  A must for modern sexy UI.

See this on cocoadev.

C4[2] Registration is open!…and closed.

Saturday, August 2nd, 2008

Well, shit.

8:30 PM, July 31: 75% of seats for C4[2] have been sold.  (C4 Twitter)

2:01 AM, August 1: C4[2] registration opens for the public early Friday morning, 2:01 AM, 8/1.  

9:00 AM, August 2: C4[2] is sold out.

I completely missed the announcement until this morning.  And apparently, previous attendees got first dibs at an early private registration.

C4 has been a small gathering in past years, with attendees capped at around 75.  So there were likely around 18-20 open spots left when public registration opened.  That’s not very many.

Looks like C4 is becoming an exclusive event along the lines of Davos.  Someday, I’ll be invited.  Oh, crap, I just spilled my milk…