Skip to content

Commit 1d10d28

Browse files
committed
clean up
1 parent 9764977 commit 1d10d28

File tree

3 files changed

+82
-11
lines changed

3 files changed

+82
-11
lines changed

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ViewStoreDeprecations.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
88

99
## Topics
1010

11+
### Creating a view store
12+
13+
- ``ViewStore/init(_:removeDuplicates:)``
14+
- ``ViewStore/init(_:)-1pfeq``
15+
1116
### Interacting with concurrency
1217

1318
- ``ViewStore/suspend(while:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/ViewStore.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
### Creating a view store
66

7-
- ``init(_:removeDuplicates:)``
8-
- ``init(_:)-1pfeq``
7+
- ``init(_:observe:removeDuplicates:)``
8+
- ``init(_:observe:)``
99
- ``init(_:)-4il0f``
1010
- ``ViewStoreOf``
1111

1212
### Accessing state
1313

14-
- ``state``
14+
- ``state-swift.property``
1515
- ``subscript(dynamicMember:)-kwxk``
1616

1717
### Sending actions

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 74 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,60 @@ public final class ViewStore<ViewState, ViewAction>: ObservableObject {
137137

138138
/// Initializes a view store from a store.
139139
///
140+
/// > Warning: This initializer is deprecated. Use
141+
/// ``ViewStore/init(_:observe:removeDuplicates:)`` to make state observation explicit.
142+
/// >
143+
/// > When using ``ViewStore`` you should take care to observe only the pieces of state that
144+
/// your view needs to do its job, especially towards the root of the application. See
145+
/// <doc:Performance> for more details.
146+
///
140147
/// - Parameters:
141148
/// - store: A store.
142149
/// - isDuplicate: A function to determine when two `State` values are equal. When values are
143150
/// equal, repeat view computations are removed.
144151
@available(
145152
iOS,
146153
deprecated: 9999.0,
147-
message: "Use 'init(_:observe:removeDuplicates:)' to make state observation explicit."
154+
message: """
155+
Use 'init(_:observe:removeDuplicates:)' to make state observation explicit.
156+
157+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
158+
159+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
160+
"""
148161
)
149162
@available(
150163
macOS,
151164
deprecated: 9999.0,
152-
message: "Use 'init(_:observe:removeDuplicates:)' to make state observation explicit."
165+
message: """
166+
Use 'init(_:observe:removeDuplicates:)' to make state observation explicit.
167+
168+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
169+
170+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
171+
"""
153172
)
154173
@available(
155174
tvOS,
156175
deprecated: 9999.0,
157-
message: "Use 'init(_:observe:removeDuplicates:)' to make state observation explicit."
176+
message: """
177+
Use 'init(_:observe:removeDuplicates:)' to make state observation explicit.
178+
179+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
180+
181+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
182+
"""
158183
)
159184
@available(
160185
watchOS,
161186
deprecated: 9999.0,
162-
message: "Use 'init(_:observe:removeDuplicates:)' to make state observation explicit."
187+
message: """
188+
Use 'init(_:observe:removeDuplicates:)' to make state observation explicit.
189+
190+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
191+
192+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
193+
"""
163194
)
164195
public init(
165196
_ store: Store<ViewState, ViewAction>,
@@ -564,25 +595,60 @@ extension ViewStore where ViewState: Equatable {
564595
self.init(store, observe: toViewState, send: fromViewAction, removeDuplicates: ==)
565596
}
566597

598+
/// Initializes a view store from a store.
599+
///
600+
/// > Warning: This initializer is deprecated. Use
601+
/// ``ViewStore/init(_:observe:)`` to make state observation explicit.
602+
/// >
603+
/// > When using ``ViewStore`` you should take care to observe only the pieces of state that
604+
/// your view needs to do its job, especially towards the root of the application. See
605+
/// <doc:Performance> for more details.
606+
///
607+
/// - Parameters:
608+
/// - store: A store.
567609
@available(
568610
iOS,
569611
deprecated: 9999.0,
570-
message: "Use 'init(_:observe:)' to make state observation explicit."
612+
message: """
613+
Use 'init(_:observe:)' to make state observation explicit.
614+
615+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
616+
617+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
618+
"""
571619
)
572620
@available(
573621
macOS,
574622
deprecated: 9999.0,
575-
message: "Use 'init(_:observe:)' to make state observation explicit."
623+
message: """
624+
Use 'init(_:observe:)' to make state observation explicit.
625+
626+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
627+
628+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
629+
"""
576630
)
577631
@available(
578632
tvOS,
579633
deprecated: 9999.0,
580-
message: "Use 'init(_:observe:)' to make state observation explicit."
634+
message: """
635+
Use 'init(_:observe:)' to make state observation explicit.
636+
637+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
638+
639+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
640+
"""
581641
)
582642
@available(
583643
watchOS,
584644
deprecated: 9999.0,
585-
message: "Use 'init(_:observe:)' to make state observation explicit."
645+
message: """
646+
Use 'init(_:observe:)' to make state observation explicit.
647+
648+
When using ViewStore you should take care to observe only the pieces of state that your view needs to do its job, especially towards the root of the application. See the performance article for more details:
649+
650+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
651+
"""
586652
)
587653
public convenience init(_ store: Store<ViewState, ViewAction>) {
588654
self.init(store, removeDuplicates: ==)

0 commit comments

Comments
 (0)