Avatar
Avatar
koher
@swift-5.7.3 struct Foo {} protocol Bar { associatedtype Foos: Sequence where Foos.Element == Foo var foos: Foos { get } } struct Baz: Bar { var foos: [Foo] { [Foo()] } } let bar: any Bar = Baz() var iterator = (bar.foos as any Sequence).makeIterator() as any IteratorProtocol while let foo = iterator.next() { print(foo) } (edited)
Foo() (edited)