FileManager
class FileManager : NSObject
This extension allows the FileManager to generate a unique directory name.
-
Creates a temporary directory with a unique name and returns its URL.
Note
You should not rely on the existence of the temporary directory after the app is exited.
Declaration
Swift
func urlForUniqueTemporaryDirectory(preferredName: String? = nil) throws -> (url: URL, deleteDirectory: () throws -> Void)
Return Value
A tuple of the directory’s URL and a delete function. Call the function to delete the directory after you’re done with it.