Last active
May 22, 2018 16:50
-
-
Save jayrhynas/8c253efa5499b7040e3d47df9f87ad49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Dictionary { | |
init<S>(grouping values: S, by kp: KeyPath<S.Element, Key>) throws where Value == [S.Element], S: Sequence { | |
try self.init(grouping: values, by: { $0[keyPath: kp] }) | |
} | |
} | |
// Crashes: | |
// extension Dictionary { | |
// init<S, K>(grouping values: S, by kp: K) throws where Value == [S.Element], S: Sequence, K: KeyPath<S.Element, Key> { | |
// try self.init(grouping: values, by: { $0[keyPath: kp] }) | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment