My apologies if there is a separate forum for Xcode 10, but I didn't see it.
I have the following code for a UIDocument subclass to generate a thumbail image for the UIDocumentBrowswerViewController to dispay.
public override func fileAttributesToWrite(to url: URL, for saveOperation: UIDocument.SaveOperation) throws -> [AnyHashable : Any] {
let slide = self.slideAtIndex(0)!
let image = slide.image(self.imageSize, document: self)
return [
URLResourceKey.hasHiddenExtensionKey: true,
URLResourceKey.thumbnailDictionaryKey: [
URLThumbnailDictionaryItem.NSThumbnail1024x1024SizeKey: image
]
]
}
Xcode10/Swift 4.2 has changed the signature to:
publicoverridefunc fileAttributesToWrite(to url: URL, for saveOperation: UIDocument.SaveOperation) throws -> [FileAttributeKey : Any]
It does not compile because the return dictionary key types do not match. There does not seem to be a FileAttributeKey for saving a thumbnail. Is this an oversight or is there a way around this? For now I've filed rdar://40808963
Thanks,
Dave