🅿️IteratorProtocol

  • 具有 next() 方法的物件就可遵循 IteratorProtocol,也就是一個 iterator

  • 類似 JS 的 iterator protocol。

public protocol IteratorProtocol {
  associatedtype Element
  mutating func next() -> Element?
}

Last updated

Was this helpful?