Suffix

Published by Simon Schoeters

Leopard Tech Talk notes

On the train back home from the Leopard Tech Talk conference at the Hilton in Amsterdam. Saw some good presentations by Paul Burford and Ricardo Aráoz going from Core Animation to Xcode 3. Time to write down the most interesting topics of the day.

A Leopard introduction

Not a lot to learn from Paul's general Leopard introduction as we tried out most features a few weeks ago but still some news here. Apparently Apple decided not to enable Time Machine backups over a wireless connection due to some technical issues but it's still on the feature list and should be included in one of the next updates. Why else would they have a USB connection on the Airport Extreme? It will be possible to buy a large USB hard drive, connect it to your Airport and use it as the Time Machine backup disk for all the Macs on your home network. The Time Machine backups are stored in a sensible data structure to make it possible to retrieve files even if you need to access it from Tiger for example.

Remember the fuss around the whole Leopard resolution independence thing? As far as I followed the discussion nobody mentioned it once Leopard came out. I may have missed the blogs but hey, Leopard has resolution independence built-in! Install the Leopard development tools, check the Quartz Debug application in /Developer/Applications/Graphics Tools and enable the “Show User Interface Resolution” slider in the Tools menu. Play around with the slider and see it in action. As Paul noted not all Apple's applications are fully compliant yet (check Finder and you see it isn't) but it's definitely a good indication of what it will be.

Quick View & Spotlight

Apple encourages developers to write Spotlight plugins if your application has some kind of proprietary document format so that Spotlight can index your data as well. It's important your Spotlight plugin is as small and performant as possible. Don't load the full document in memory but only extract those elements that may be useful for users to search on. This is important as your plugin is loaded each time one of your documents is created or modified... make sure it scales!

Someone in the audience was wondering if it would make sense to include an application's database as well. It's possible (a database is a file after all) but it's probably not such a good idea as you are indexing one database into another (Spotlight doesn't look directly on your file system, it's using an internal database). In the future it will be possible to call your database directly from Spotlight so maybe it's better to leave this for now.

What if you want to overwrite a specific Quick View or Spotlight plugin? Both applications look for their plugins with the following priority: the associated application, the user library, /Library and /System/Library/Plugins. This means you can overwrite an Apple plugin by placing yours in one of the ‘higher’ folders. Note that the associated application always wins so it's not possible to write your own PDF renderer for Quick View if you want to use Adobe Reader as your main PDF application.

Core Animation

On the conference agenda this seemed one of the least interesting topics (what do I know from animations?!) but it turned out to be a typical “Yes, I need to try this at home!” conference thing.

So what is it? It's a library to animate a user interface in Leopard. Ever seen the animation when one of your buddies comes online in iChat? Or maybe the ripple effect if you open Skype's call history? In Tiger someone wrote an algorithm to do this, in Leopard it's built in with the Core Animation library. This is a nice way to show a status change in a subtle way and seems really easy to implement. Done correctly it could be a big plus but it can also instantly ruin your interface when overdone. Apple recognizes this and there will be some guidelines in the pipeline on how, when and where to use these animations but the iPhone guidelines got priority.

Every element in Core Animation has it's own layer and you animate elements by modifying the layer properties. The elements on these layers are not aware of the animation so this means a button or checkbox will still work, even when it's ‘animated’. The value change in the code is instantly, the moment you define the new values it takes effect in your code, even when the animation takes a few seconds to complete. There is no need add wait loops in the code. This also means an animation doesn't block the user interface and can be interrupted at all times. Core Animation is implicit, it knows when to kick in once you call an animation method (but you can call it explicitly for more complex animations).

Animations are started in serial mode so if you call a move and shrink animation on the same object it will first move and then shrink. Add an animation group if you want your animations to start simultaneous (at the group closing statement).

Don't forget to enable the ‘wants layer’ option in Interface Builder to enable Core Animation or it won't work. One last remark here: Core Animation was called LayerKit before so replace all LKMethodeName references in Apple's examples by CAMethodeName.

XCode 3.0

Is Xcode the preferred Java editor for Mac OS X? No, it isn't. Everyone I spoke today points to Eclipse for Java developments. That said it still is a good choice for Cocoa and Carbon coding. Carbon misses most of the 64-bit fun so maybe Apple is finally dropping Carbon in favor of Cocoa? Two new features (amongst others) in Xcode 3 worth mentioning:

  • Refactoring: finally Xcode has code refactoring but only for Objective-C and C at the moment.
  • Snapshots: Xcode now has built in Subversion support but Apple also added snapshots, a local versioning feature.

ImageIO

Apple extracted some common image functions in a separate library as they found out a lot of the development teams were writing the same kind of code: iPhoto, Aperture, Photo Boot and others all need a media browser, image previews, etc. So far the ImageIO library supports the most common image formats but we may expect more supported file type sets in the future.

ImageKit includes: a viewer, an editor, a browser, a picture taker, a slideshow and other elements. The library is aimed at Apple's pro applications so it should be perfect for browsing large media archives with lots of heavy high quality images (or even movies): it's gradually loading your images as you scroll along. CoverFlow is not included as it's no Core Animation, it's written in OpenGL.

This blog post is open source. Did you spot a mistake? Have any ideas for improvements? Contribute to this post via Github. Thank you!