Skip to content

Instantly share code, notes, and snippets.

@Kdan
Created July 7, 2020 06:30
Show Gist options
  • Select an option

  • Save Kdan/668dc2b5159a3d837d9cf3771002d756 to your computer and use it in GitHub Desktop.

Select an option

Save Kdan/668dc2b5159a3d837d9cf3771002d756 to your computer and use it in GitHub Desktop.
/// A Bool indicating if the class has received any function calls.
var hasReceivedCalls: Bool { get }
/// Retrieve the potential calls for a given function name.
/// - Parameters:
/// - name: The name of the function to retrieve calls for.
/// - Returns: The optional `FunctionCall` for the name provided.
func calls(with name: FunctionName) -> FunctionCall?
/// Log a function call with the given name and parameters.
/// - Parameters:
/// - name: The name of the function to log.
/// - parameters: The list of parameters to add to the log.
func logFunctionCall(with name: String = #function, parameters: [Any?] = [])
/// Log a function call with the given name and parameters.
/// - Parameters:
/// - name: The name of the function to log.
/// - parameters: The list of parameters to add to the log.
/// - response: The response to return after logging the function call.
func logAndReturn<T>(with name: String = #function, parameters: [Any?] = [], _ response: T) -> T
/// Reset the function logs.
func resetFunctionLog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment