Skip to content

Commit 3c522a0

Browse files
committed
Removed the section about @required initializers for now, based on technical feedback from Doug.
Doug says: “It’s really hard to motivate required initializers without protocols, and the only one our audience is likely to see is init(coder:). I suggest that we shelve this section for now, and bring it back when we can say something about creating instances from values of protocol metatype.”
1 parent 0a56a01 commit 3c522a0

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

LanguageGuide/Initialization.rst

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ which provides a textual description of a ``ShoppingListItem`` instance:
997997
Because it provides a default value for all of the properties it introduces,
998998
and does not define any initializers itself,
999999
``ShoppingListItem`` automatically inherits
1000-
*all* of the designated and convenience initializers from it superclass.
1000+
*all* of the designated and convenience initializers from its superclass.
10011001

10021002
The figure below shows the overall initializer chain for all three classes:
10031003

@@ -1044,32 +1044,6 @@ shows that their default states have been set as expected.
10441044
.. TODO: Feedback from Beto is that it would be useful to indicate the flow
10451045
through these inherited initializers.
10461046
1047-
.. _Initialization_RequiredInitializers:
1048-
1049-
Required Initializers
1050-
~~~~~~~~~~~~~~~~~~~~~
1051-
1052-
You can apply the ``@required`` attribute to
1053-
a designated or convenience initializer of a class
1054-
to indicate that every subclass of that class must implement the initializer.
1055-
1056-
Even if an initializer is marked as ``@required``,
1057-
you may not have to provide an explicit implementation of that initializer,
1058-
and may be able to satisfy the requirement with an inherited initializer instead.
1059-
Requirements are satisfied based on the following two rules:
1060-
1061-
**Rule 1**
1062-
If your superclass has a required *designated* initializer,
1063-
you must provide an implementation of that initializer.
1064-
The requirement can't be satisfied by an inherited initializer.
1065-
1066-
**Rule 2**
1067-
If your superclass has a required *convenience* initializer,
1068-
you can satisfy the requirement with an inherited initializer,
1069-
even if the requirement started life as a designated initializer higher up the chain.
1070-
1071-
.. TODO: provide an example.
1072-
10731047
.. _Initialization_SettingADefaultPropertyValueWithAClosureOrFunction:
10741048

10751049
Setting A Default Property Value with a Closure or Function
@@ -1173,4 +1147,7 @@ and can be queried with the ``squareIsBlackAtRow`` utility function:
11731147
-> println(board.squareIsBlackAtRow(0, column: 1))
11741148
<- true
11751149
-> println(board.squareIsBlackAtRow(9, column: 9))
1176-
<- false
1150+
<- false
1151+
1152+
.. TODO: reinstate the section about @required initializers
1153+
once we can say something about creating instances from values of protocol metatype.

0 commit comments

Comments
 (0)