Skip to content

Commit 659ee33

Browse files
committed
Cross reference with Nested Types chapter.
1 parent a45e8c3 commit 659ee33

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

TSPL.docc/LanguageGuide/NestedTypes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
Define types inside the scope of another type.
44

55
Enumerations are often created to support a specific class or structure's functionality.
6-
Similarly, it can be convenient to define utility classes and structures
7-
purely for use within the context of a more complex type.
6+
Similarly, it can be convenient to define utility structures
7+
purely for use within the context of a more complex type,
8+
and protocols that are normally used in conjunction with a specific type.
89
To accomplish this, Swift enables you to define *nested types*,
9-
whereby you nest supporting enumerations, classes, and structures
10+
whereby you nest supporting types like enumerations, structures, and protocols
1011
within the definition of the type they support.
1112

1213
To nest a type within another type,

TSPL.docc/LanguageGuide/Protocols.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,14 @@ The `DiceGame` protocol is a protocol that can be adopted
858858
by any game that involves dice.
859859

860860
The `DiceGame.Delegate` protocol can be adopted
861-
to track the progress of a `DiceGame`.
861+
to track the progress of a type that implements `DiceGame`.
862862
Because the `DiceGame.Delegate` protocol
863863
is always used in the context of a dice game,
864864
it's nested inside of the `DiceGame` protocol.
865865
Protocols can be nested inside of other protocols
866866
and inside of type declarations like structures and classes,
867867
as long as the outer declaration isn't generic.
868+
For information about nesting types, see <doc:NestedTypes>.
868869

869870
To prevent strong reference cycles,
870871
delegates are declared as weak references.

0 commit comments

Comments
 (0)