Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created March 22, 2021 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/3f50ce122fa47a08d85cfc22535da579 to your computer and use it in GitHub Desktop.
Save laevandus/3f50ce122fa47a08d85cfc22535da579 to your computer and use it in GitHub Desktop.
struct Entry: ExpressibleByStringInterpolation {
// typealias StringInterpolation = EntryInterpolation
private(set) var value: String
init(stringLiteral value: String) {
self.value = value
}
init(stringInterpolation: EntryInterpolation) {
self.value = stringInterpolation.values.joined()
}
}
struct EntryInterpolation: StringInterpolationProtocol {
private(set) var values: [String]
init(literalCapacity: Int, interpolationCount: Int) {
self.values = []
}
mutating func appendLiteral(_ literal: StringLiteralType) {
values.append(literal)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment