The problem is really simple. This causes a segmentation fault:
extension Sequence {
func parallelForEach<T, R>(_ f: @escaping (T) -> R, completion: @escaping ([R]) -> ()) where Iterator.Element == T {
}
}
Clearly I don't know how to write a protocol extension anymore. Someone help please? :)
The error was me thinking that I needed the generic type T. Since it was just Iterator.Element which is happily a type within the Sequence protocol.
Kudos to anyone who can explain why the compiler didn't like it. It's clearly inefficient but why should it be wrong?