Commit b529ff5
authored
Deprecate
* Deprecate `Shared`'s optional dynamic member lookup overload
Currently, `Shared`'s dynamic member lookup is overloaded for
convenience:
```swift
$shared // Shared<Root>
$shared.value // Shared<Value>
$shared.optionalValue // Shared<Value>?
```
Unfortunately, this is also perhaps surprising, and goes against the
grain when folks might expect to be handed a `Shared<Value?>`.
Also, there are times when you have a `Shared<Value?>` already, and you
want to unwrap it. Dynamic member lookup doesn't help there (unless you
know you can call `$shared[dynamicMember: \.self]`), and so you need a
totally different operation to handle it:
```swift
if let unwrappedShared = Shared($optional) {
// Do something with 'Shared<Value>'
}
```
So let's avoid this confusion in the future and focus on a single API
for unwrapping shared values, which is the failable initializer that
mirrors an API on `Binding`.
* wip
* Update SharedReader.swift
* Update Shared.swift
* Update SharedReader.swiftShared's optional dynamic member lookup overload (#3145)1 parent 63a0795 commit b529ff5
File tree
3 files changed
+69
-28
lines changed3 files changed
+69
-28
lines changedLines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
120 | 127 | | |
121 | 128 | | |
122 | 129 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
361 | 364 | | |
362 | 365 | | |
363 | 366 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
| 367 | + | |
372 | 368 | | |
373 | 369 | | |
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments