Structure

URLResourceKey

Keys that apply to file system URLs.

Overview

To request information using one of these keys, pass it to the forKey: parameter of the getResourceValue(_:forKey:) instance method.

Topics

Constants

static let fileAllocatedSizeKey: URLResourceKey

Key for the total size allocated on disk for the file, returned as an NSNumber object (read-only).

static let fileSizeKey: URLResourceKey

Key for the file’s size in bytes, returned as an NSNumber object (read-only).

static let isAliasFileKey: URLResourceKey

Key for determining whether the file is an alias, returned as a Boolean NSNumber object (read-only).

static let isUbiquitousItemKey: URLResourceKey

A boolean NSNumber that contains true if this item is in iCloud storage, false if it is a local item (read-only).

static let keysOfUnsetValuesKey: URLResourceKey

Key for the resource properties that have not been set after the setResourceValues(_:) method returns an error, returned as an array of of NSString objects.

static let totalFileAllocatedSizeKey: URLResourceKey

Key for the total allocated size of the file in bytes, returned as an NSNumber object (read-only). This includes the size of any file metadata.

static let totalFileSizeKey: URLResourceKey

Key for the total displayable size of the file in bytes, returned as an NSNumber object (read-only). This includes the size of any file metadata.

static let ubiquitousItemContainerDisplayNameKey: URLResourceKey

A string containing the name of the item’s container, as it is displayed to the user.

static let ubiquitousItemDownloadRequestedKey: URLResourceKey

A Boolean indicating whether a call to startDownloadingUbiquitousItem(at:) has already been made to download the item. The value of this key is read-only.

static let ubiquitousItemDownloadingErrorKey: URLResourceKey

An error object that indicates why downloading the item from iCloud failed. See Foundation Constants for possible error codes.

static let ubiquitousItemDownloadingStatusKey: URLResourceKey

The current download state for the item, indicating whether a local copy exists and whether that copy is the most current version of the item. The possible values for this key are described in URLUbiquitousItemDownloadingStatus.

static let ubiquitousItemHasUnresolvedConflictsKey: URLResourceKey

A boolean NSNumber that contains true if this item has conflicts outstanding, false otherwise (read-only).

static let ubiquitousItemIsDownloadedKey: URLResourceKey

A boolean NSNumber that contains true if this item’s data has been downloaded to a ubiquity container, false otherwise (read-only).

Deprecated
static let ubiquitousItemIsDownloadingKey: URLResourceKey

A boolean NSNumber that contains true if this item is being downloaded from iCloud, false otherwise (read-only).

static let ubiquitousItemIsUploadedKey: URLResourceKey

A boolean NSNumber that contains true if this item’s data has been uploaded to iCloud storage, false otherwise (read-only).

static let ubiquitousItemIsUploadingKey: URLResourceKey

A boolean NSNumber that contains true if this item is being uploaded to iCloud, false otherwise (read-only).

static let ubiquitousItemPercentDownloadedKey: URLResourceKey

An NSNumber in the range 0–100 that indicates the percentage of the data that has been downloaded (read-only).

Deprecated
static let ubiquitousItemPercentUploadedKey: URLResourceKey

An NSNumber in the range 0–100 that indicates the percentage of the data that has been uploaded (read-only).

Deprecated
static let ubiquitousItemUploadingErrorKey: URLResourceKey

An error object that indicates why uploading the item to iCloud failed. See Foundation Constants for possible error codes.

static let volumeAvailableCapacityKey: URLResourceKey

Key for the volume’s available capacity in bytes, returned as an NSNumber object (read-only).

static let volumeCreationDateKey: URLResourceKey

Key for the volume’s creation date, returned as an NSDate object, or NULL if it cannot be determined (read-only).

static let volumeIsAutomountedKey: URLResourceKey

Key for determining whether the volume is automounted, returned as a Boolean NSNumber object (read-only).

static let volumeIsBrowsableKey: URLResourceKey

Key for determining whether the volume is visible in GUI-based file-browsing environments, such as the Desktop or the Finder application, returned as a Boolean NSNumber object (read-only).

static let volumeIsEjectableKey: URLResourceKey

Key for determining whether the volume is ejectable from the drive mechanism under software control, returned as a Boolean NSNumber object (read-only).

static let volumeIsEncryptedKey: URLResourceKey

Whether the volume is encrypted, returned as NSNumber containing a Boolean value (read-only).

static let volumeIsInternalKey: URLResourceKey

Key for determining whether the volume is connected to an internal bus, returned as a Boolean NSNumber object, or nil if it cannot be determined (read-only).

static let volumeIsJournalingKey: URLResourceKey

Key for determining whether the volume is currently journaling, returned as a Boolean NSNumber object (read-only).

static let volumeIsLocalKey: URLResourceKey

Key for determining whether the volume is stored on a local device, returned as a Boolean NSNumber object (read-only).

static let volumeIsReadOnlyKey: URLResourceKey

Key for determining whether the volume is read-only, returned as a Boolean NSNumber object (read-only).

static let volumeIsRemovableKey: URLResourceKey

Key for determining whether the volume is removable from the drive mechanism, returned as a Boolean NSNumber object (read-only).

static let volumeIsRootFileSystemKey: URLResourceKey

Whether the volume is the root filesystem, returned as NSNumber containing a Boolean value (read-only).

static let volumeLocalizedFormatDescriptionKey: URLResourceKey

Key for the volume’s descriptive format name, returned as an NSString object (read-only).

static let volumeLocalizedNameKey: URLResourceKey

The name of the volume as it should be displayed in the user interface, returned as an NSString object (read-only).

static let volumeMaximumFileSizeKey: URLResourceKey

Key for the largest file size supported by the volume in bytes, returned as a Boolean NSNumber object, or nil if it cannot be determined (read-only).

static let volumeNameKey: URLResourceKey

The name of the volume, returned as an NSString object (read-write). Settable only if NSURLVolumeSupportsRenamingKey is true.

static let volumeResourceCountKey: URLResourceKey

Key for the total number of resources on the volume, returned as an NSNumber object (read-only).

static let volumeSupportsAdvisoryFileLockingKey: URLResourceKey

Key for determining whether the volume implements whole-file advisory locks in the style of flock, along with the O_EXLOCK and O_SHLOCK flags of the open function, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsCasePreservedNamesKey: URLResourceKey

Key for determining whether the volume supports case-preserved names, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsCaseSensitiveNamesKey: URLResourceKey

Key for determining whether the volume supports case-sensitive names, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsCompressionKey: URLResourceKey

Whether the volume supports transparent decompression of compressed files using decmpfs, returned as NSNumber containing a Boolean value (read-only).

static let volumeSupportsExclusiveRenamingKey: URLResourceKey

Whether the volume supports exclusive renaming using renamex_np(2) with the RENAME_EXCL option, returned as NSNumber containing a Boolean value (read-only).

static let volumeSupportsExtendedSecurityKey: URLResourceKey

Key for determining whether the volume supports extended security (access control lists), returned as a Boolean NSNumber object (read-only) (read-only).

static let volumeSupportsFileCloningKey: URLResourceKey

Whether the volume supports cloning using clonefile(2), returned as NSNumber containing a Boolean value (read-only).

static let volumeSupportsHardLinksKey: URLResourceKey

Key for determining whether the volume supports hard links, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsJournalingKey: URLResourceKey

Key for determining whether the volume supports journaling, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsPersistentIDsKey: URLResourceKey

Key for determining whether the volume supports persistent IDs, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsRenamingKey: URLResourceKey

Key for determining whether the volume can be renamed, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsRootDirectoryDatesKey: URLResourceKey

Key for determining whether the volume supports reliable storage of times for the root directory, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsSparseFilesKey: URLResourceKey

Key for determining whether the volume supports sparse files, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsSwapRenamingKey: URLResourceKey

Whether the volume supports renaming using renamex_np(2) with the RENAME_SWAP option, returned as NSNumber containing a Boolean value (read-only).

static let volumeSupportsSymbolicLinksKey: URLResourceKey

Key for determining whether the volume supports symbolic links, returned as a Boolean NSNumber object (read-only).

static let volumeSupportsVolumeSizesKey: URLResourceKey

Key for determining whether the volume supports returning volume size information, returned as a Boolean NSNumber object (read-only). If true, volume size information is available as values of the volumeTotalCapacityKey andvolumeAvailableCapacityKey keys.

static let volumeSupportsZeroRunsKey: URLResourceKey

Key for determining whether the volume supports zero runs, returned as a Boolean NSNumber object (read-only).

static let volumeTotalCapacityKey: URLResourceKey

Key for the volume’s capacity in bytes, returned as an NSNumber object (read-only).

static let volumeURLForRemountingKey: URLResourceKey

Key for the URL needed to remount the network volume, returned as an NSURL object, or nil if a URL is not available (read-only).

static let volumeUUIDStringKey: URLResourceKey

Key for the volume’s persistent UUID, returned as an NSString object, or nil if a persistent UUID is not available (read-only).

static let addedToDirectoryDateKey: URLResourceKey

The time at which the resource’s was created or renamed into or within its parent directory, returned as an NSDate. Inconsistent behavior may be observed when this attribute is requested on hard-linked items. This property is not supported by all volumes. (read-only)

static let attributeModificationDateKey: URLResourceKey

The time at which the resource’s attributes were most recently modified, returned as an NSDate object if the volume supports attribute modification dates, or nil if attribute modification dates are unsupported (read-only).

static let contentAccessDateKey: URLResourceKey

The time at which the resource was most recently accessed, returned as an NSDate object if the volume supports access dates, or nil if access dates are unsupported (read-only).

static let contentModificationDateKey: URLResourceKey

The time at which the resource was most recently modified, returned as an NSDate object if the volume supports modification dates, or nil if modification dates are unsupported (read-write).

static let creationDateKey: URLResourceKey

The resource’s creation date, returned as an NSDate object if the volume supports creation dates, or nil if creation dates are unsupported (read-write).

static let customIconKey: URLResourceKey

The icon stored with the resource, returned as an NSImage object, or nil if the resource has no custom icon.

static let documentIdentifierKey: URLResourceKey

The document identifier returned as an NSNumber (read-only).

static let effectiveIconKey: URLResourceKey

The resource’s normal icon, returned as an NSImage object (read-only).

static let fileResourceIdentifierKey: URLResourceKey

The resource’s unique identifier, returned as an id (read-only).

static let fileResourceTypeKey: URLResourceKey

The resource’s object type, returned as an NSString object (read-only). See URLFileResourceType for possible values.

static let fileSecurityKey: URLResourceKey

The resource’s security information, returned as an NSFileSecurity object (read-write).

static let generationIdentifierKey: URLResourceKey

An opaque generation identifier, returned as an id <NSCopying, NSCoding, NSObject> (read-only)

static let hasHiddenExtensionKey: URLResourceKey

Key for determining whether the resource’s extension is normally removed from its localized name, returned as a Boolean NSNumber object (read-write).

static let isDirectoryKey: URLResourceKey

Key for determining whether the resource is a directory, returned as a Boolean NSNumber object (read-only).

static let isExcludedFromBackupKey: URLResourceKey

Key for determining whether the resource is excluded from all backups of app data, returned as a Boolean NSNumber object (read-write).

static let isExecutableKey: URLResourceKey

Key for determining whether the current process (as determined by the EUID) can execute the resource (if it is a file) or search the resource (if it is a directory), returned as a Boolean NSNumber object (read-only).

static let isHiddenKey: URLResourceKey

Key for determining whether the resource is normally not displayed to users, returned as a Boolean NSNumber object (read-write).

static let isMountTriggerKey: URLResourceKey

Key for determining whether the URL is a file system trigger directory, returned as a Boolean NSNumber object (read-only). Traversing or opening a file system trigger directory causes an attempt to mount a file system on the directory.

static let isPackageKey: URLResourceKey

Key for determining whether the resource is a file package, returned as a Boolean NSNumber object (read-write in macOS 10.8 and later, read-only in previous versions). A true value means that the resource is a file package.

static let isReadableKey: URLResourceKey

Key for determining whether the current process (as determined by the EUID) can read the resource, returned as a Boolean NSNumber object (read-only).

static let isRegularFileKey: URLResourceKey

Key for determining whether the resource is a regular file, as opposed to a directory or a symbolic link. Returned as a Boolean NSNumber object (read-only).

static let isSymbolicLinkKey: URLResourceKey

Key for determining whether the resource is a symbolic link, returned as a Boolean NSNumber object (read-only).

static let isSystemImmutableKey: URLResourceKey

Key for determining whether the resource's system immutable bit is set, returned as a Boolean NSNumber object (read-write).

static let isUserImmutableKey: URLResourceKey

Key for determining whether the resource's user immutable bit is set, returned as a Boolean NSNumber object (read-write).

static let isVolumeKey: URLResourceKey

Key for determining whether the resource is the root directory of a volume, returned as a Boolean NSNumber object (read-only).

static let isWritableKey: URLResourceKey

Key for determining whether the current process (as determined by the EUID) can write to the resource, returned as a Boolean NSNumber object (read-only).

static let labelColorKey: URLResourceKey

The resource’s label color, returned as an NSColor object, or nil if the resource has no label color (read-only).

static let labelNumberKey: URLResourceKey

The resource’s label number, returned as an NSNumber object (read-write).

static let linkCountKey: URLResourceKey

The number of hard links to the resource, returned as an NSNumber object (read-only).

static let localizedLabelKey: URLResourceKey

The resource’s localized label text, returned as an NSString object, or nil if the resource has no localized label text (read-only).

static let localizedNameKey: URLResourceKey

The resource’s localized or extension-hidden name, returned as an NSString object (read-only).

static let localizedTypeDescriptionKey: URLResourceKey

The resource’s localized type description, returned as an NSString object (read-only).

static let nameKey: URLResourceKey

The resource’s name in the file system, returned as an NSString object (read-write).

static let parentDirectoryURLKey: URLResourceKey

The parent directory of the resource, returned as an NSURL object, or nil if the resource is the root directory of its volume (read-only).

static let pathKey: URLResourceKey

The file system path for the URL, returned as an NSString object (read-only).

static let preferredIOBlockSizeKey: URLResourceKey

The optimal block size to use when reading or writing this file's data, returned as an NSNumber object, or nil if the preferred size is not available (read-only).

static let tagNamesKey: URLResourceKey

The names of tags attached to the resource, returned as an array of NSString values (read-write).

static let thumbnailDictionaryKey: URLResourceKey

A dictionary of NSImage/UIImage objects keyed by size (read-write). See URLThumbnailDictionaryItem for a list of possible keys.

static let thumbnailKey: URLResourceKey

All thumbnails as a single NSImage (read-write).

static let typeIdentifierKey: URLResourceKey

The resource’s uniform type identifier (UTI), returned as an NSString object (read-only).

static let volumeIdentifierKey: URLResourceKey

The unique identifier of the resource’s volume, returned as an id (read-only).

static let volumeURLKey: URLResourceKey

The root directory of the resource’s volume, returned as an NSURL object (read-only).

Relationships

See Also

Accessing Resource Values

func resourceValues(forKeys: Set<URLResourceKey>)

Return a collection of resource values identified by the given resource keys.

func setResourceValues(URLResourceValues)

Sets the resource value identified by a given resource key.

func removeCachedResourceValue(forKey: URLResourceKey)

Removes the cached resource value identified by a given resource value key from the URL object.

func removeAllCachedResourceValues()

Removes all cached resource values and all temporary resource values from the URL object.

func setTemporaryResourceValue(Any, forKey: URLResourceKey)

Sets a temporary resource value on the URL object.

struct URLResourceValues

The properties supported by file system resources.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software