FileManager

class FileManager : NSObject
  • Mechanica

    Cleans all contents in a directory path.

    Throws

    throws an error in cases of failure.

    Declaration

    Swift

    public final func cleanDirectory(atPath path: String) throws

    Parameters

    path

    directory path (if it’s not a directory path, nothing is done).

  • Mechanica

    Delete a file or a directory at a given path.

    Throws

    throws an error in cases of failure.

    Declaration

    Swift

    public final func deleteFileOrDirectory(atPath path: String) throws

    Parameters

    path

    directory or file path.

  • Mechanica

    Creates and returns always a new directory in Library/Caches in the user’s home directory for discardable cache files.

    Declaration

    Swift

    public final func newCachesSubDirectory(in domain: FileManager.SearchPathDomainMask = .userDomainMask, withName name: String = UUID().uuidString) throws -> URL