I made an extremely tiny package to conform tuples to protocols using parameter packs. I made this because I've been needing Hashable, Comparable and Codable tuples. Here’s a copy of the README for posterity:
Swift Tuple
An extremely simple solution to conform tuples to protocols.
Overview
Did you ever want to conform Swift tuples to protocols?
Excellent point, I hadn’t noticed because the project in which I use this also had its logic backwards. That’s embarrassing.
Oh I know why that happened, I used to have an Array as backing storage before parameter packs:
for (lhs, rhs) in zip(lhs, rhs) where lhs != rhs {
return false
}
return true
Parameter packs don't support where clauses in for-loops however (reason unclear) and I moved it to an if, then when copied to the package I changed it for a guard forgetting to invert the condition.
It's not quite a tuple, but, If we had something like this in the language (standard library) would we need to have anything else. Bonus point - compared to normal tuples this tuple could be of arity 1 (and even 0).
PS. (init(flatten:) doesn't sound right. maybe init(tuple:) or init(rawValue:) or init(rawTuple:).