This file contains 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 Delegate<Input, Output> { | |
private var block: ((Input) -> Output?)? | |
func delegate<T: AnyObject>(on target: T, block: ((T, Input) -> Output)?) { | |
self.block = { [weak target] input in | |
guard let target = target else { return nil } | |
return block?(target, input) | |
} | |
} | |
func call(_ input: Input) -> Output? { |
This file contains 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
public struct SomeTypeWrapper<Base> { | |
public | |
} |