struct|class|enum SimpleVariadic<T: variadic P1> { } extension SimpleVariadic { var someTs: T { /* ... */ } func testCollection() -> (T...) { // All your `map`, `filter`, etc are here! let arr1: [String] = someTs.map { "\($0)" } let arr2: [P1] = someTs.filter { $0 is Int } let first: P1? = someTs.first return (someTs...) } }
#ifempty
じゃなくて (variadic型).first みたいな。