Version 3.1, 2015-12-03
Updated for 10.11 SDK, replaced deprecated APIs, improved error checking for resolving security scope bookmark search location.
(Full Revision History)
OS X 10.11 SDK or later
OS X 10.9 or later
This sample application uses Spotlight to perform a search for images on your computer. The NSPredicateEditor is used to create a custom search query. The results are displayed in a custom NSTextFieldCell subclass that automatically adds tracking areas to perform automatic rollover highlighting effects inside the cells. A custom DateCell class is implemented that demonstrates how to properly truncate dates based on the cell size. The NSPathControl is used to display selected paths. Custom views inside a menu are shown with sample code. Finally, thread safe background thumbnail image processing is demonstrated by the data model.
PhotoSearch is App Sandboxed which offers strong defense against damage from malicious code. In doing so, it allows you to retain access to file-system resources by employing a security mechanism, known as security-scoped bookmarks, that preserves user intent between app launches. Hence, the earch location or scope becomes a security-scoped bookmark.