Last active
January 26, 2021 14:15
-
-
Save Kdan/dcaa97a0b729431cd4f86e27b05c5c80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FunctionCall: Hashable { | |
| /// The name of the function | |
| let name: FunctionName | |
| /// The number of calls for the function. | |
| var numberOfCalls: Int { calls.count } | |
| /// The parameters sent to the function. | |
| private(set) var calls = [Any?]() | |
| init(name: FunctionName) { | |
| self.name = name | |
| } | |
| /// Append a call to the function with the given parameters. | |
| /// - Parameter parameters: The parameters to append. | |
| func append<T>(_ parameters: T?) { | |
| calls.append(parameters) | |
| } | |
| static func == (lhs: FunctionCall, rhs: FunctionCall) -> Bool { | |
| lhs.name == rhs.name | |
| } | |
| public func hash(into hasher: inout Hasher) { | |
| hasher.combine(name) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment