0

I have the code:

do {
    try manager.createDirectory(atPath: appDir!.appendingPathComponent(path).path, withIntermediateDirectories: true, attributes: nil)
} catch {
    print("Error: \(error)")
}

How do I add a custom icon to the directory (like Dropbox, Creative Cloud, etc.)? Do I add it as an attribute?

ctkrocks
  • 95
  • 2
  • 12

1 Answers1

3

Got it!

NSWorkspace.shared().setIcon(#imageLiteral(resourceName: "customFolder"), forFile: appDir!.appendingPathComponent("/Files").path, options: NSWorkspaceIconCreationOptions.excludeQuickDrawElementsIconCreationOption)

Use that.

ctkrocks
  • 95
  • 2
  • 12