Instance Method


Moves an item to the trash.


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



The item to move to the trash.


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.


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.