Archive for the ‘Cocoa’ Category

Leopard Developer Application Technologies Overview

The Application Technologies Overview is the third instalment in the Leopard Technology Series for Developers and was partly authored by James Duncan Davidson.

It briefly covers integrating your application with Time Machine, iChat, and Calendar Store. More interesting is the new Scripting Bridge. It’s a replacement for using AppleScript in your app to communicate with another app. The “Scripting Bridge uses native Cocoa data types, such as NSString and NSArray, requires far less code than using an NSAppleEventDescriptor, and runs more than twice as fast as a precompiled NSAppleScript”. An example is given for getting the current track name from iTunes.

NSString *currentTrackName = [[iTunes currentTrack] name];

As far as I know, the Scripting Bridge hasn’t been mentioned in any Leopard discussions. It appears the Bridge lets a developer write Cocoa, but paraphrasing the classes and commands in an application’s Scripting Dictionary. If so, this will be quite tedious for developers to implement. In practice, they’ll have to write an AppleScript to determine how an application’s Scripting Dictionary works. Then developers will have to translate the AppleScript into the equivalent Cocoa code. It would have been nice if Apple could have provided practical information how developers will work with the Scripting Bridge. As well, the example given only demos the Scripting Bridge getting data from an application. But does the Scripting Bridge work both ways? Will it also send data to another application, and does it provide for the receiving application transforming the data and returning the result to your application? If the Scripting Bridge is two-way then the benefits gained by using it will far outweigh the mucking around us developers have to do with NSAppleScript and friends.

The article also mentions Core Animation and 64/32-bit hardware support, but these are treated too briefly to get an idea of how they might be used in an application.

Sidekick 1.4 available now

Just in time for Christmas…

I’ve released a new version of Sidekick, a menu bar item for AppleWorks 6. The main feature of this release is being able to use Mac OS X 10.4’s Dictionary and Thesaurus program directly (indirectly?) from AppleWorks 6.

AppleWorks is a Carbon application that really wasn’t updated for Mac OS X. It was ported to Mac OS X, but no Mac OS X specific features were added. So you can’t do things like use Mac OS X’s Services from AppleWorks. I’ve addressed this by having Sidekick grab highlighted text from the frontmost word processing document and pass it on to NSPerformService() for action. So now AppleWorks users can use the Dictionary and Thesaurus program, do a Spotlight search, Summarize text, Speak text, open a URL, or copy selected text to a new Mail message.

But this feature is only available to registered users – those who’ve purchased it. I’m not sure if this is going to be controversial or not. Sidekick’s user base is relatively small and most have purchased it. New users will be able to get a taste of the feature by using the existing Send Selection feature to do a Google search, etc.

Leopard Developer Tools Overview

Apple have published the second article in their Leopard Technology Series for Developers. This one’s about the updated dev tools in 10.5.

The Xcode Editor improvements will be nice, especially highlighting compile-time errors and warnings. Fixing these is a pain in 10.4. You have to click the red, round, error icon in the bottom right of the Xcode window to jump to the first error. With Xcode 3 a bubble appears at the line where the error occurred. This doesn’t appear to be much of an improvement. It appears you still have to scroll thru your file to find the bubble. I’d much rather be presented with a list of errors in a separate HUD window so that I could pick an error and jump immediately to it and then inspect the info in the bubble. Don’t get me wrong, the bubble feature is a definite improvement because it provides info about, and an easy way to correct errors.

Code folding has been added to the Xcode Editor. This feature needs a shortcut key if it is to be useful. (I loathe dragging a mouse about on screen.) I wonder if the folding feature is now available to all Cocoa apps via NSTextView or some other API?

The new Research Assistant in Xcode is an excellent addition. In 10.4 you have to swap between the Documentation window and your code window. But in 10.5 you’ll be able to view the Research Assistant window right beside your code window.

The article also discusses Objective-C’s automatic garbage collection feature, the new for iterator, and a simpler way to create accessor methods, similar to Ruby.

Interface Builder gets an update in 10.5 too. Unfortunately the screen shots are very small and I could barely see details of the new Core Animation properties in the Inspector window and the new UI palette.

Lastly, the article discusses ‘the poor man’s source code control’ feature – Project Snapshots. I’m really looking forward to this so I can go to town on my source code and being able to simply revert my changes without having to muck around with a SCM system.

AeroXperience on Mac OS X 10.5 Leopard

AeroXperience (a forum for Windows Vista developers) gives us more intel on Mac OS X 10.5 (aka Leopard):

  • Disk recovery tools now built into Disk Utility,
  • an improved Firewall,
  • dictionary lookups and mathematical calculations from Spotlight,
  • new developer contols (Mail-like buttons)

Objective C 2.0

Nice article from explaining the Objective-C changes coming in Mac OS X 10.5.

Developer Kit for Mac OS X 10.5/Leopard

Apple have made available 10.5 seeds, reference documentation and WWDC videos to Select and Premier developers. Visit the Leopard Early Start Kit.

For the less rich among us, free articles will be published as part of the Leopard Technology Series for Developers. Unfortunately, these will probably be very brief, with little detail, like the similar Tiger/10.4 series of articles.

Easier navigation in Xcode source files

Here’s a great tip from Cocoa Samurai: put a Pragma mark in your source code to add headings and separators. This helps to organise your code, but the biggest advantage is that it makes navigation from the Xcode function popup much easier and nicer to use.

Cocoa Dev Central web site redesign

Cocoa Dev Central is an excellent site for learning Cocoa and has just got a facelift. The site’s owner is Scott Stevenson. You can read about the redesign and his thoughts about software development over at Theocacao.

Find an interface element from Interface Builder

Here’s a new tip from Apple: How can I visually identify the various components of my interface in Interface Builder?

The answer is: ctrl+shift click an interface element in the outline view of the Instances pane and a blue arrow will appear next to the element. See Technical Q&A QA1323 for a picture of this in action. It reminds me of the purple arrow feature being added Mac OS X 10.5 Help.

Why Carbon sucks.

If you haven’t already, pop over and read Wil Shipley’s latest blog entry, Pimp My Code, Part 12: Frozen in Carbonite, to find out why.

The comments are an interesting read too. Many people are missing the point, and going off on a tangent regarding the speed of C vs Objective C, etc.