Skip to content

Commit f6d5b70

Browse files
authored
Clarify that SwiftUI synthesized init rule only applies to internal views (#350)
1 parent 33e066c commit f6d5b70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4802,15 +4802,15 @@ _You can enable the following settings in Xcode by running [this script](resourc
48024802

48034803
## SwiftUI
48044804

4805-
- <a id='swiftui-synthesized-init'></a>(<a href='#swiftui-synthesized-init'>link</a>) **For SwiftUI views, prefer using the synthesized memberwise init** by defining internal properties rather than private properties.
4805+
- <a id='swiftui-synthesized-init'></a>(<a href='#swiftui-synthesized-init'>link</a>) **For internal SwiftUI views, prefer using the synthesized memberwise init** by defining internal properties rather than private properties.
48064806

48074807
<details>
48084808

48094809
[![SwiftFormat: redundantMemberwiseInit](https://img.shields.io/badge/SwiftFormat-redundantMemberwiseInit-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#redundantMemberwiseInit)
48104810

48114811
#### Why?
48124812

4813-
Using `internal` properties allows the compiler to synthesize a memberwise initializer, reducing boilerplate.
4813+
Using `internal` properties allows the compiler to synthesize the default internal memberwise initializer, reducing boilerplate.
48144814

48154815
```swift
48164816
// WRONG

0 commit comments

Comments
 (0)