Last active
December 23, 2016 01:01
-
-
Save andersio/29e1b714129e2643c38dca44dd69405a 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
| infix operator <~ | |
| //func <~<T: Target, S: Source>(left: T, right: S) { | |
| // print("Free Function") | |
| //} | |
| //func <~<S: Source>(left: BindingTarget, right: S) { | |
| // print("Free Function 2") | |
| //} | |
| protocol Source { | |
| } | |
| protocol Target { | |
| static func <~ <S: Source>(left: Self, right: S) | |
| } | |
| extension Target { | |
| static func <~ <S: Source>(left: Self, right: S) { | |
| print("Default") | |
| } | |
| } | |
| public struct CustomizedSignal: Source { | |
| static func <~ <T: Target>(left: T, right: CustomizedSignal) { | |
| print("BindingTarget") | |
| } | |
| static func <~ (left: BindingTarget, right: CustomizedSignal) { | |
| print("CustomizedSignalBindingTarget") | |
| } | |
| } | |
| public struct Signal: Source { | |
| } | |
| public struct Property: Target { | |
| } | |
| public struct BindingTarget: Target { | |
| static func <~ <S: Source>(left: BindingTarget, right: S) { | |
| print("BindingTarget") | |
| } | |
| } | |
| BindingTarget() <~ Signal() | |
| BindingTarget() <~ CustomizedSignal() | |
| Property() <~ Signal() | |
| Property() <~ CustomizedSignal() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment