Created
April 12, 2023 21:57
-
-
Save tpgmeligmeyling/686addcc9916d882e930b54f3438e2b9 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
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