Skip to content

Instantly share code, notes, and snippets.

@kutschenator
Last active September 4, 2017 13:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kutschenator/68b3568dfbbe74f3369e699c3bb7b31d to your computer and use it in GitHub Desktop.
Save kutschenator/68b3568dfbbe74f3369e699c3bb7b31d to your computer and use it in GitHub Desktop.
StaticallyAccessible
postfix operator ~
protocol StaticallyAccessible { }
extension StaticallyAccessible {
static postfix func ~ (c: Self) -> Self.Type {
return type(of: c)
}
var 🌩: Self.Type {
return type(of: self)
}
}
class X: StaticallyAccessible {
func doStuff() {
type(of: self).doStaticStuff()
self~.doStaticStuff()
🌩.doStaticStuff()
}
static func doStaticStuff() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment