> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swift/type/ext.md).

# extension

╱🚧 under construction

[Swift](/ios/swift.md) ⟩ [type](/ios/swift/type.md) ⟩ extension

{% hint style="success" %}

{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="success" %}
Extensions in Swift can:

* Add <mark style="color:red;">**computed**</mark> <mark style="color:orange;">**instance**</mark>/<mark style="color:orange;">**type**</mark> **properties**.
* Define <mark style="color:orange;">**instance**</mark>/<mark style="color:orange;">**type**</mark> <mark style="color:red;">**methods**</mark>.
* Provide new <mark style="color:red;">**initializers**</mark>.
* Define [<mark style="color:red;">**subscripts**</mark>](/ios/swift/subscripts.md).
* Define and use new <mark style="color:red;">**nested types**</mark>.
* Make an existing type <mark style="color:purple;">**conform to**</mark> a [<mark style="color:orange;">**protocol**</mark>](/ios/swift/type/category/protocol.md).
* ([Protocol Extensions](/ios/swift/type/category/protocol/protocol-extensions.md)) provide <mark style="color:red;">**default implementations**</mark> or add <mark style="color:red;">**additional functionality**</mark>.
  {% endhint %}
  {% endtab %}

{% tab title="🔴 主題" %}

* [extension of nested types](/ios/swift/type/category/nested-types/extension-of-nested-type.md)
* [extension of typealias❓](/ios/swift/type/ext/extension-of-typealias.md)
  {% endtab %}

{% tab title="📘 手冊" %}

* Swift ⟩ [Extensions](https://docs.swift.org/swift-book/LanguageGuide/Extensions.html)
  {% endtab %}

{% tab title="👥 相關" %}

* can define [nested types](/ios/swift/type/category/nested-types.md).
  {% endtab %}
  {% endtabs %}
