---
description: ╱🚧 under construction
---

# extension

[Swift](..) ⟩ [type]() ⟩ 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>](../subscripts).
* 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>](category/protocol).
* ([protocol-extensions](category/protocol/protocol-extensions "mention")) provide <mark style="color:red;">**default implementations**</mark> or add <mark style="color:red;">**additional functionality**</mark>.
{% endhint %}
{% endtab %}

{% tab title="🔴 主題" %}
* [extension-of-nested-type](category/nested-types/extension-of-nested-type "mention")
* [extension-of-typealias](ext/extension-of-typealias "mention")
{% endtab %}

{% tab title="📘 手冊" %}
* Swift ⟩ [Extensions](https://docs.swift.org/swift-book/LanguageGuide/Extensions.html)
{% endtab %}

{% tab title="👥 相關" %}
* can define [nested-types](category/nested-types "mention").
{% endtab %}
{% endtabs %}
