I'm working with NSFileProviderReplicatedExtension for macOS app. I want to apply default badge on files(For example, com.apple.icon-decoration.badge.warning
, com.apple.icon-decoration.badge.pinned
, .. etc).
I am unable to see any badge when I open the folder mounted by the Extension.
I've defined NSFileProviderDecorations
in NSExtension
as follows :
<dict>
<key>NSFileProviderDecorations</key>
<array>
<dict>
<key>BadgeImageType</key>
<string>com.apple.icon-decoration.pinned</string>
<key>Category</key>
<string>Badge</string>
<key>Identifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).cyfile</string>
<key>Label</key>
<string>CydriveFile</string>
</dict>
</array>
<key>NSExtensionFileProviderDocumentGroup</key>
<string>$(TeamIdentifierPrefix)com.example.app-group</string>
<key>NSExtensionFileProviderSupportsEnumeration</key>
<true/>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.fileprovider-nonui</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).FileProviderExtension</string>
</dict>
I have implemented the class Item that's implementing the following Protocols :
NSObject, NSFileProviderItemProtocol, NSFileProviderItemDecorating
and when returning decorations
for that item I'm just doing this :
class Item : ... {
...
static let decorationPrefix = Bundle.main.bundleIdentifier!
static let heartItem = NSFileProviderItemDecorationIdentifier(rawValue: "\(decorationPrefix).cyfile")
var decorations: [NSFileProviderItemDecorationIdentifier]? {
var decos = [NSFileProviderItemDecorationIdentifier]()
decos.append(CyItem.heartItem)
return decos
}
}
As far as i can tell I've completed all the requirements for getting the badge to show up.