Instance Method

trashItem(at:resultingItemURL:)

Moves an item to the trash.

Declaration

func trashItem(at url: URL, resultingItemURL outResultingURL: AutoreleasingUnsafeMutablePointer<NSURL?>?) throws

Parameters

url

The item to move to the trash.

outResultingURL

On input, a pointer to a URL object. On output, this pointer is set to the item’s location in the trash. The actual name of the item may be changed when moving it to the trash, so use this URL to access it. You may specify nil for this parameter if you do not want the information.

Return Value

true if the item at url was successfully moved to the trash, or false if the item was not moved to the trash.

Discussion

See Also

Creating and Deleting Items

func createFile(atPath: String, contents: Data?, attributes: [FileAttributeKey : Any]?) -> Bool

Creates a file with the specified content and attributes at the given location.

func removeItem(at: URL)

Removes the file or directory at the specified URL.

func removeItem(atPath: String)

Removes the file or directory at the specified path.