I was looking at the documentation for contentsOfDirectory(at:includingPropertiesForKeys:options:)
Particularly I've been focusing on the argument includingPropertiesForKeys
, which said:
An array of keys that identify the file properties that you want pre-fetched for each item in the directory. For each returned URL, the specified properties are fetched and cached in the NSURL object. For a list of keys you can specify, see Common File System Resource Keys.
Clicking on URLResourceKey led me to the Apple Documentation about it.
And I was wondering, if I passed in keys like fileResourceTypeKey
, fileResourceIdentifierKey
, and creationDateKey
how could I access those in the returned URL list (after calling contentsOfDirectory(at:includingPropertiesForKeys:options:)
)?
And I was also confused by the URLResourceKey
enum b/c a lot of types have similar descriptions and names to other keys like:
documentIdentifierKey
vsfileResourceIdentifierKey
vslocalizedNameKey
vsnameKey
localizedTypeDescriptionKey
vsfileResourceTypeKey
vstypeIdentifierKey
- the urls returned by the
contentsOfDirectory(at:includingPropertiesForKeys:options:)
vspathKey
Like what would be the differences between these keys?
Basically I have a really low understanding of the file system at this point so please bear with my "simple" questions. If someone could explain what all these keys means and how I can access/use them that would be great!