I have this code:
struct Tweak<Value> {
var name: String
var value: Value
}
func name<Value>(of tweak: Tweak<Value>) -> String {
return tweak.name
}
func names<Value1, Value2>(of tweak1: Tweak<Value1>, _ tweak2: Tweak<Value2>) -> (String, String) {
return (tweak1.name, tweak2.name)
}
Now I want to implement the second function using parameter packs:
func names<each Value>(of tweak: repeat Tweak<each Value>) -> (repeat String) {
return repeat each tweak.name
}
But that gives this error:
error: pack expansion 'String' must contain at least one pack reference
func names<each Value>(of tweak: repeat Tweak<each Value>) -> (repeat String) {
^~~~~~~~~~~~~
What is the correct syntax for doing this? Or is it impossible to spell this?
Thanks,
Marco