Avatar
struct Path<T1, T2> {} protocol PathConstructorType { associatedtype T1 associatedtype T2 associatedtype PathType = Path<T1, T2> } struct PathConstructor<T1, T2>: PathConstructorType { func create(path: [String]) -> PathType { fatalError() } } extension PathConstructor where T2: PathConstructorType { typealias PathType = Path<T1, T2.PathType> } 実際のコードはこんな感じで、PathConstructor<T1, PathConstructor<T2, T3>>Path<T1, Path<T2, T3>> に変換するために再帰させたいなーと