swifticonsutinsworkspace

How do you create a UTType for System Declared Uniform Type Identifiers for folder?


I see all kinds of examples for using a file or an extension but I am trying to call let imag = NSWorkspace.shared.icon(for: <#T##UTType#>) and I don't see any init method in UUType that takes a identifier e.g. folder.


Solution

  • UTType is declared in the Uniform Type Identifiers framework.

    All uou need to do is import UniformTypeIdentifiers and then you'll be able to write things like UTType.folder.