withTemporaryDirectory(prefix:options:execute:)

    Create a temporary directory and removes it once the function returns.

    FileSystemProtocol.swift:643
    iOS
    13.0+
    macOS
    10.15+
    tvOS
    13.0+
    watchOS
    6.0+
    func withTemporaryDirectory<Result>(prefix: FilePath? = nil, options: OpenOptions.Directory = OpenOptions.Directory(), execute: (_ directory: DirectoryFileHandle, _ path: FilePath) async throws -> Result) async throws -> Result

    Parameters

    prefix

    The prefix to use for the path of the temporary directory.

    options

    Options used to create the directory.

    execute

    A closure which provides access to the directory and its path.

    Returns

    The result of execute.

    You can use prefix to specify the directory in which the temporary directory should be created. If prefix is nil then the value of temporaryDirectory is used as the prefix.

    The temporary directory, and all of its contents, is removed once execute returns.

    See also

    Other members in extension

    Instance members

    Show obsolete interfaces (1)

    Hide obsolete interfaces