/
Launch Apollo Studio


EXTENSION

ApolloExtension

public extension ApolloExtension where Base: DictionaryType, Base.KeyType: RawRepresentable, Base.KeyType.RawValue == String, Base.ValueType: Any

Properties

toStringKeyedDict

var toStringKeyedDict: [String: Any]

Transforms a dictionary keyed by a String enum into a dictionary keyed by the string values of that enum.

Methods

fileExists(at:)

public func fileExists(at path: String) -> Bool

Checks if a file exists (and is not a folder) at the given path

  • Parameter path: The path to check
  • Returns: true if there is something at the path and it is a file, not a folder.

Parameters

NameDescription
pathThe path to check

fileExists(at:)

public func fileExists(at url: URL) -> Bool

Checks if a file exists (and is not a folder) at the given URL

  • Parameter url: The URL to check
  • Returns: true if there is something at the URL and it is a file, not a folder.

Parameters

NameDescription
urlThe URL to check

folderExists(at:)

public func folderExists(at path: String) -> Bool

Checks if a folder exists (and is not a file) at the given path.

  • Parameter path: The path to check
  • Returns: true if there is something at the path and it is a folder, not a file.

Parameters

NameDescription
pathThe path to check

folderExists(at:)

public func folderExists(at url: URL) -> Bool

Checks if a folder exists (and is not a file) at the given URL.

  • Parameter url: The URL to check
  • Returns: true if there is something at the URL and it is a folder, not a file.

Parameters

NameDescription
urlThe URL to check

deleteFolder(at:)

public func deleteFolder(at url: URL) throws

Checks if a folder exists then attempts to delete it if it's there.

  • Parameter url: The URL to delete the folder for

Parameters

NameDescription
urlThe URL to delete the folder for

deleteFile(at:)

public func deleteFile(at url: URL) throws

Checks if a file exists then attempts to delete it if it's there.

  • Parameter url: The URL to delete the file for

Parameters

NameDescription
urlThe URL to delete the file for

createContainingFolderIfNeeded(for:)

public func createContainingFolderIfNeeded(for fileURL: URL) throws

Creates the containing folder (including all intermediate directories) for the given file URL if necessary.

  • Parameter fileURL: The URL of the file to create a containing folder for if necessary.

Parameters

NameDescription
fileURLThe URL of the file to create a containing folder for if necessary.

createFolderIfNeeded(at:)

public func createFolderIfNeeded(at url: URL) throws

Creates the folder (including all intermediate directories) for the given URL if necessary.

  • Parameter url: The URL of the folder to create if necessary.

Parameters

NameDescription
urlThe URL of the folder to create if necessary.

shasum(at:)

public func shasum(at fileURL: URL) throws -> String

Calculates the SHASUM (ie, SHA256 hash) of the given file

  • Parameter fileURL: The file to calculate the SHASUM for.

Parameters

NameDescription
fileURLThe file to calculate the SHASUM for.

parentFolderURL()

public func parentFolderURL() -> URL
  • Returns: the URL to the parent folder of the current URL.

childFolderURL(folderName:)

public func childFolderURL(folderName: String) -> URL
  • Parameter folderName: The name of the child folder to append to the current URL
  • Returns: The full URL including the appended child folder.

Parameters

NameDescription
folderNameThe name of the child folder to append to the current URL

childFileURL(fileName:)

public func childFileURL(fileName: String) throws -> URL

Adds the filename to the caller to get the full URL of a file

  • Parameters:

    • fileName: The name of the child file, with an extension, for example "API.swift". Note: For hidden files just pass ".filename".
  • Returns: The full URL including the full file.

Parameters

NameDescription
fileNameThe name of the child file, with an extension, for example "API.swift". Note: For hidden files just pass ".filename".
Edit on GitHub