Avatar
コメント5回位読み直してやっと少しわかりましたw
7:57 AM
@swift-main enum GenericElement {} protocol MySequenceP { associatedtype Element associatedtype Iterator: IteratorProtocol where Iterator.Element == Element func makeIterator() -> Iterator } struct MyDefaultIterator: IteratorProtocol { func next() -> GenericElement? { return nil } } protocol MyCollectionP: MySequenceP { override associatedtype Element associatedtype Iterator = MyDefaultIterator } struct MyCustomIterator: IteratorProtocol { func next() -> GenericElement? { return nil } } struct MyCollection: MyCollectionP { typealias Element = GenericElement func makeIterator() -> MyCustomIterator { return .init() } }