Last active
May 5, 2022 11:24
-
-
Save Dev1an/3383459c7360097f73a9e8f9025903ce 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
enum TypeGenerator { | |
private static var last: Chainable.Type = Chain<Void>.self | |
private enum Chain<X>: Chainable { | |
static func chain() -> Chainable.Type { Chain<Self>.self } | |
} | |
static func next() -> Chainable.Type { | |
Self.last = Self.last.chain() | |
return Self.last | |
} | |
} | |
protocol Chainable { | |
static func chain() -> Chainable.Type | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment