Howti populate Finder comment from NSFileProviderItemProtocol extendedAttributes

I am trying to populate the Finder comment field from extendedAttributes with the code bellow but it doesn't work.

Any idea why ?

var extendedAttributes: [String : Data] {
    var attrs = [String: Data]()

    let comment = self.caption
    do {
        let xmlPlistData = try PropertyListSerialization.data(fromPropertyList: comment as Any, format: .xml, options: 0)
            attrs["com.apple.metadata:kMDItemFinderComment"] = xmlPlistData
   } catch {
        NSLog("Error during plist conversion: \(error)")
    }
    return attrs
}
Howti populate Finder comment from NSFileProviderItemProtocol extendedAttributes
 
 
Q