Last active
July 31, 2020 04:23
-
-
Save serhiybutz/49f7fefa4d7dc42d63b1e72b4a39d886 to your computer and use it in GitHub Desktop.
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
protocol TargetAction { | |
func applyTheme(_ theme: MyTheme) | |
} | |
struct AnyTargetActionWrapper<T: AnyObject>: TargetAction { | |
weak var target: T? | |
let action: (T) -> (MyTheme) -> () | |
func applyTheme(_ theme: MyTheme) -> () { | |
if let t = target { | |
action(t)(theme) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment