Skip to content

Instantly share code, notes, and snippets.

@blinker13
Created April 4, 2016 08:56
Show Gist options
  • Save blinker13/241111b73338e8aca2d11e9d3fbea3e6 to your computer and use it in GitHub Desktop.
Save blinker13/241111b73338e8aca2d11e9d3fbea3e6 to your computer and use it in GitHub Desktop.
public protocol Command {
associatedtype Input
associatedtype Output
func execute(input:Input) -> Output
}
public final class Signal<Input, Output> : Command {
private let block:(Input) -> Output
public init(_ block:(Input) -> Output) {
self.block = block
}
public func execute(input:Input) -> Output {
return block(input)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment