You can use the following two methods to overlay icons on folders / files.
You can use the -setIcon: forFile: options: method in NSWorkspace if you want to change the file or folder icon in Mac OS X. However, after you apply the icon overlay with this method, the overlay is complete even if you move this file / folder outside. This may not be the exact solution.
Instead, use the Finder Sync Extension application (File - New - Target - Finder Sync Extension) inside your application. After creating the extension, your application does not have a direct connection for this purpose. To activate, use the AppleScript command (I don't think there is a better alternative for this.)
To activate
NSString * pluginPath = [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent: @ "yourextension.appex"];
NSString * pluginkitString = [NSString stringWithFormat: @ "pluginkit -e use -a \"% @ \ "", pluginPath]; system ([pluginkitString cStringUsingEncoding: NSUTF8StringEncoding]);
After activating a goal, there are several ways our application can interact with this extension. Few of them:
Using NSDistributedNotificationCenter. This class provides a way to send notifications to objects in other tasks (for example, an extension).
Another way is to use [[NSUserDefaults alloc] initWithSuiteName: @ "teamid.com.company.test"];
Both your application and the goal must have a common group identifier (for example, teamid.com.company.test). To do this, turn on "Application groups" in the "Target" - "Application groups" section and specify an identifier similar to the above (for example, "teamid.com.company.test"), were teamid - this is the identifier that you will receive from the developer's portal Apple Follow the same steps for your expansion goal.
Before you complete, make sure the extension is activated or not. To verify that go to "System Preferences" - "Extensions" - "Search for applications." This is the global point at which the user can enable / disable icon mapping for your application.
source share