setBadgeIdentifier(_:for:)
Sets the badge for a file or directory.
Declaration
func setBadgeIdentifier(_ badgeID: String, for url: URL)Parameters
- badgeID:
A unique ID, identifying the badge.
- url:
The URL of the file or directory.
Discussion
Adds the specified badge to the given file or directory. Setting the identifier to an empty string (@"") removes the badge.
Avoid adding badges to items that the Finder hasn’t displayed yet. When setting the initial badge, call this method from your Finder Sync extension’s requestBadgeIdentifier(for:) method. When updating badges, call this method only for items that have already received a badge.