Skip to content

Commit b0b8735

Browse files
committed
wip: Conditional Conformance
1 parent 49c3a1c commit b0b8735

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

swift-6-beta.docc/ReferenceManual/Declarations.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,14 +2194,9 @@ extension <#type name#>: <#adopted protocols#> where <#requirements#> {
21942194

21952195
扩展声明不能为现有类添加类继承,因此您只能在*类型名称*和冒号后指定协议列表。
21962196

2197-
### Conditional Conformance
2198-
2199-
You can extend a generic type
2200-
to conditionally conform to a protocol,
2201-
so that instances of the type conform to the protocol
2202-
only when certain requirements are met.
2203-
You add conditional conformance to a protocol
2204-
by including *requirements* in an extension declaration.
2197+
### 条件遵循
2198+
2199+
您可以扩展一个泛型类型以有条件地遵循一个协议,从而使该类型的实例仅在满足某些要求时遵循该协议。您通过在扩展声明中包含*要求*来添加对协议的条件遵循。
22052200

22062201
#### Overridden Requirements Aren't Used in Some Generic Contexts
22072202

0 commit comments

Comments
 (0)