File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,23 @@ CHANGELOG
22
22
Swift 4.1
23
23
---------
24
24
25
+ * [ SE-0189] [ ]
26
+
27
+ If an initializer is declared in a different module from a struct, it must
28
+ use ` self.init(…) ` or ` self = … ` before returning or accessing ` self ` .
29
+ Failure to do so will produce a warning in Swift 4 and an error in Swift 5.
30
+ This is to keep a client app from accidentally depending on a library's
31
+ implementation details, and matches an existing restriction for classes,
32
+ where cross-module initializers must be convenience initializers.
33
+
34
+ This will most commonly affect code that extends a struct imported from C.
35
+ However, most imported C structs are given a zeroing no-argument initializer,
36
+ which can be called as ` self.init() ` before modifying specific properties.
37
+
38
+ Swift library authors who wish to continue allowing initialization on a
39
+ per-member basis should explicitly declare a public memberwise initializer
40
+ for clients in other modules to use.
41
+
25
42
* [ SE-0166] [ ] / [ SE-0143] [ ]
26
43
27
44
The standard library now defines the conformances of ` Optional ` ,
You can’t perform that action at this time.
0 commit comments