# Sequence

{% tabs %}
{% tab title="🌀 擴充" %}
* [seq.sum](sequence/seq.sum "mention") - sum of elements.
{% endtab %}

{% tab title="📜 協定" %}
![](https://1830103165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-JmwCZMKh_d7RfBaN%2F-MNWB5bMQtAmlO6_4_SD%2F-MNWC1847VSX5fGGtkA3%2FCollection%20Types.jpg?alt=media\&token=cbbc820e-a072-4711-8aef-b0cb65fb6c70)
{% endtab %}

{% tab title="🔸 定義" %}
```swift
public protocol Sequence {
  associatedtype Element
  associatedtype Iterator: IteratorProtocol where Iterator.Element == Element
  func makeIterator() -> Iterator
  // other requirements ...
}
```
{% endtab %}

{% tab title="📘 手冊" %}
* Swift ⟩ [Sequence](https://developer.apple.com/documentation/swift/sequence)
{% endtab %}

{% tab title="👥 相關" %}
* 類似 JS 的 **iterable** protocol
{% endtab %}
{% endtabs %}
