We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c31b184 commit 7691fbdCopy full SHA for 7691fbd
CHANGELOG.md
@@ -66,12 +66,22 @@ Swift Next
66
// This will now error, because the protocol requirement
67
// is implicitly mutating and the setter is implicitly
68
// nonmutating.
69
- set { someProperty = newValue }
+ set { someProperty = newValue } // Error
70
}
71
72
```
73
74
- To resolve this, explicitly mark the setter as `nonmutating` in the protocol.
+ **Workaround**: Define a new mutable property inside the setter that has a reference to `self`:
75
+
76
+ ```swift
77
+ var anotherProperty1: Int {
78
+ get { return someProperty }
79
+ set {
80
+ var mutableSelf = self
81
+ mutableSelf.someProperty = newValue // Okay
82
+ }
83
84
+```
85
86
* [SE-0253][]:
87
0 commit comments