Recommended way to display user-friendly iCloud Drive paths?

I’m building a macOS app that stores file URLs/bookmarks and displays file locations in the UI.

For files in iCloud Drive, I want to show a user-friendly path such as: iCloud Drive / My Folder / File.jpg rather than an internal filesystem path.

What is the recommended way to display iCloud Drive paths in a way that matches what users see in Finder?

Thanks!

Answered by Engineer in 890858022

You can check out componentsToDisplay(forPath:) - it returns the localized, Finder-style display names for a path components (e.g. iCloud Drive, hidden extensions).

Docs: https://developer.apple.com/documentation/foundation/filemanager/componentstodisplay(forpath:)

You can check out componentsToDisplay(forPath:) - it returns the localized, Finder-style display names for a path components (e.g. iCloud Drive, hidden extensions).

Docs: https://developer.apple.com/documentation/foundation/filemanager/componentstodisplay(forpath:)

Recommended way to display user-friendly iCloud Drive paths?
 
 
Q