August 21st, 2006
Something I’ve been meaning to do for a long, long time, is set up some custom project templates in Xcode. The problem is, it doesn’t really take that long to tweak all the little things in a new project, so when I’m in the mood to start something new, I usually just go through all the grunt steps.
Today I decided to put together a template that should cover at least 90% of the grunt work for typical applications I start work on. I started with a great example from Jon Wight of Toxic Software. His “CocoaApp” template did a lot of the things I wanted to do, but lacked a few whistles and bells. I thought I’d just work from his and it would be easy.
Instead it was amazingly, unbelievably difficult. The major complication comes from persuading Xcode’s template manager to actually do the substitutions it promises to do. See, at the root of the template system is this behavior where Xcode will replace certain tags in your files with appropriate values for the new project. The tags are surrounded by French quotes, chevrons, whatever … you know: «these». That’s fine, but depending on whether the file is in MacRoman, UTF-8, or UTF-16 format, the chevrons are a different value. Ugh, it’s infuriating the way they would sneak back and forth. I still don’t quite understand the logic applied by Xcode in deciding which encoding to look for, when. To make matters more complicated, I strived for (and accomplished) something truly amazing: an end to the “NewApplication” text in new project nib files. To achieve this I had to save the nib as XML format, but even then it was difficult to get the files into a suitable format that was still parseable as XML, yet would satisfy Xcode’s template system. This is so fragile that the nib files in the template are not even openable in Interface Builder – so unfortunately you won’t be able to tweak them without some serious hacking.
But the end result is nothing short of amazing, I’m proud to say. Download the Red Sweater Cocoa Application template and install it on your system. Then, when you go to create your next project, enjoy all the following frills right from the start:
- Automatically names all menu items in MainMenu.nib. No more “NewApplication”!
- Automatically instantiates a delegate class named [AppName]Delegate, connected as the delegate from NSApplication, and creates the supporting source files.
- Automatically creates an AppleScript scripting definition, pointed at by the Info.plist. The scripting definition contains a skeletal dictionary with a “[AppName] Suite”, ready for you to expose your model through.
- Automatically sets the CFBundleVersion to the subversion build number through a script build phase.
- Centralizes the marketing version in one build setting called “APPLICATION_VERSION.” Just change this build setting to easily update your release version.
- Presets the application icon name to [AppName]. Just pop in a [AppName].icns file.
I think that covers it. I have kindly left out the private framework references to my Red Sweater frameworks. You should be able to edit the “Cocoa Application.pbproj” to fine-tune things to your liking, but be sure to remove the “acct.pbuser” files from within it after you do so, these have a habit of bringing some nasty values into the template which won’t get replaced by the template system.
Posted in Cocoa, Programming, Usability, Xcode | 12 Comments »
August 20th, 2006
It occurred to me that I’m using this blog to spew updates about FlexTime, and that some of you might not give the slightest damn about updates to that particular product :)
On the other side of the spectrum, I’m sure some FlexTime users would like to subscribe to news about the application without being subjected to my lengthy diatribes about gdb debugging or Cocoa programming.
I’m going to try to start making better use of categories, including the hierarchical feature in WordPress, which allows for high-level subscription to only a specific category or to a whole class that live under the same parent.
For starters I’ve moved all the existing tags/categories into two high-level groups: “Red Sweater News” and, for lack of a better name, “Articles.” Basically, “Articles” is everything of general interest to the world, with occasional announcements of major software releases. “Red Sweater News” is for my customers, or anybody interested in following all the announcements about my products. If you’re just here to see what I have to say about various topics, stick with “Articles.” I will probably further refine the Articles category in the future so you can, for instance, ignore my technical pieces and only get the opinion, or whatever. The default feed will continue to carry everything.
In summary and for future reference, here is a list of the various pages and feeds you might be interested in:
Everything – View | Subscribe
Articles Only – View | Subscribe
Red Sweater Product News – View | Subscribe
FlexTime News – View | Subscribe
FastScripts News – View | Subscribe
Clarion News – View | Subscribe
Hopefully this isn’t complicating things too much!
Posted in Articles, Red Sweater News | Comments Off on High-Level Blog Categories
August 20th, 2006
It had to happen – especially after yesterday’s proud moment of not having found any critical bugs! A user pointed out a major flaw in FlexTime’s scripting support, which would cause the simplest of all commands, “open,” from working correctly in many instances.
If you’re doing any scripting at all with FlexTime, you’ll want to grab the latest version.
Posted in FlexTime | 1 Comment »
August 19th, 2006
It’s been two days now since I released FlexTime 1.0, and lots of people have contacted me to share their ideas and impressions about the software. The great news is that nobody has contacted me to report a crash or other instability. The biggest fear when releasing software is that, in spite of extensive testing, some surprise bug is lurking. Fortunately I think most of the bugs were washed out in the beta cycles. People are reporting ideas to make it even better, not ideas to simply make it work. While there’s no great shame in a quick-turnaround to release a 1.0.1 version of a product, I admit to taking some pride in the fact that so far, this product lives up to the promises of “release quality software.”
It’s been exciting for me to watch as the world reacts. While many people are contacting me privately to share their thoughts, others are writing publicly on their blogs about their experience.
Luis de la Rosa of Happy Apps was an early adopter of FlexTime. He started using the application to help treat his repetitive strain injuries with a relatively primitive beta version a few months back. Now he’s written a blog entry describing the benefits of using FlexTime during his work day. His decision to use it for this purpose helped in guiding some of the core features such as the “show text” cues. Thanks, Luis!
Luis’s use of FlexTime as an RSI helper is just one of the many “surprising uses” that have come up over the months since I’ve shared FlexTime with the public. Now that I’ve released it to a wider audience, more ideas are rolling in. It’s a real treat to see what people come up with, and I often laugh out loud – not because the ideas are funny – but because they’re deliciously surprising.
I’m excited to share more examples in greater detail over the coming months. People are using FlexTime to “enhance” the activities that already fill their days, be it desk work, cooking, or music-making.
Posted in FlexTime | 4 Comments »