Skip to content

Instantly share code, notes, and snippets.

@motokiee
Last active December 11, 2016 16:09
Show Gist options
  • Save motokiee/c2617c790f89cf6d54f2e5b907222359 to your computer and use it in GitHub Desktop.
Save motokiee/c2617c790f89cf6d54f2e5b907222359 to your computer and use it in GitHub Desktop.
struct Extension<Base> {
let base: Base
init (_ base: Base) {
self.base = base
}
}
protocol ExtensionCompatible {
associatedtype Compatible
static var ex: Extension<Compatible>.Type { get }
var ex: Extension<Compatible> { get }
}
extension ExtensionCompatible {
static var ex: Extension<Self>.Type {
return Extension<Self>.self
}
var ex: Extension<Self> {
return Extension(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment