Skip to content

Instantly share code, notes, and snippets.

@tpgmeligmeyling
Created April 12, 2023 21:57
Show Gist options
  • Save tpgmeligmeyling/686addcc9916d882e930b54f3438e2b9 to your computer and use it in GitHub Desktop.
Save tpgmeligmeyling/686addcc9916d882e930b54f3438e2b9 to your computer and use it in GitHub Desktop.
extension KeyValuePairs {
init(elements: [(Key, Value)]) {
func initialize(elements: [(Key, Value)]) -> Self {
typealias Function = ([(Key, Value)]) -> Self
let castedInit = unsafeBitCast(Self.init(dictionaryLiteral:), to: Function.self)
return castedInit(elements)
}
self = initialize(elements: elements)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment