Xcode and Smart Groups
p. When I posted about [“Panther”:http://www.rousette.org.uk/mt-static/blog/archives/000488.html], I wondered aloud why they didn’t build in a ‘Smart Playlists’ kind of function into the Finder, so that you could have dynamic virtual folders which would automatically contain files matching the search terms you specified. At the weekend, I was having an exploratory play with [“Xcode”:http://www.apple.com/macosx/features/xcode/], and what should I find hiding there but exactly this kind of facility. In Xcode, they are called ‘Smart Groups’.
p. You can define what should be in a Smart Group using either a simple filter (file name ends in .m for example), or using a regex search. By default, two Smart Groups are set up for implementation files (.m or .c), and for Interface Builder .nib files, along with some other hard coded groups for errors and warnings, executables and so on. Smart groups can’t deal with the content of the file—which would be really cool—just the file name. However, the results of searches within files are automatically saved within a ‘Find Results’ group, and those searches can include regular expressions. Disappointingly, the find results don’t get updated dynamically. So, if I search in my project for “panther”, then I add another file which contains the word “panther”, or I add “panther” to an existing file, I have to run the search again to update the results.
