macOS, swift3
von Apple hat eine API Foundation> Dateimanager> setAttributes (_: ofItemAtPath :)Verwenden schnell und macOS-Datei-Attribute
Die Erklärung ist func setAttributes (_ Attribute: [FileAttributeKey: Jedes] , ofItemAtPath Pfad: String) wirft
Es ist für das Festlegen des Erstellungsdatums usw. für eine Datei. Ich kann mit dem> ofItem-Pfad umgehen: String) wirft <, aber der erste Teil hat mich ratlos.
Die API sagt, dass es "wahr" zurückgeben kann, aber schnelle Rückgabe ungültig. Es gibt ein Attribut namens 'creationDate'. Was ist die Bedeutung des Unterstrichs '_'?
Ich denke, ‚Attribute‘ ist ein veränderliches Wörterbuch
var myAttributesDictionary = [FileAttributeKey : Date]()
myAttributesDictionary[FileAttributeKey.creationDate] = myDateObject
let fm = FileManger()
let xxx = fm.setAttributes(myAttributesDictionary:[FileAttributeKey : creationDate], ofItemAtPath myPath)
ich viele Variationen versucht haben, und jetzt bin ich ratlos und ich weiß nicht, was erforderlich ist. Ich kann die setAttributes Zeile nicht zum kompilieren