Skip to content

Commit f56c96d

Browse files
committed
clean up
1 parent a015b04 commit f56c96d

File tree

3 files changed

+82
-10
lines changed

3 files changed

+82
-10
lines changed

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

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

55
### Creating a View Store
66

7-
- ``init(_:removeDuplicates:)``
7+
- ``init(_:observe:removeDuplicates:)``
8+
- ``init(_:observe:)``
89
- ``init(_:)-4il0f``
910
<!--NB: DocC fails to resolve the following topic-->
1011
<!--- ``init(_:)-1pfeq`-->
1112

1213
### Accessing State
1314

14-
- ``state``
15+
- ``state-swift.property``
1516
- ``subscript(dynamicMember:)-kwxk``
1617

1718
### Sending Actions

Sources/ComposableArchitecture/Documentation.docc/Extensions/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/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>,
@@ -552,25 +583,60 @@ extension ViewStore where ViewState: Equatable {
552583
self.init(store, observe: toViewState, send: fromViewAction, removeDuplicates: ==)
553584
}
554585

586+
/// Initializes a view store from a store.
587+
///
588+
/// > Warning: This initializer is deprecated. Use
589+
/// ``ViewStore/init(_:observe:)`` to make state observation explicit.
590+
/// >
591+
/// > When using ``ViewStore`` you should take care to observe only the pieces of state that
592+
/// your view needs to do its job, especially towards the root of the application. See
593+
/// <doc:Performance> for more details.
594+
///
595+
/// - Parameters:
596+
/// - store: A store.
555597
@available(
556598
iOS,
557599
deprecated: 9999.0,
558-
message: "Use 'init(_:observe:)' to make state observation explicit."
600+
message: """
601+
Use 'init(_:observe:)' to make state observation explicit.
602+
603+
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:
604+
605+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
606+
"""
559607
)
560608
@available(
561609
macOS,
562610
deprecated: 9999.0,
563-
message: "Use 'init(_:observe:)' to make state observation explicit."
611+
message: """
612+
Use 'init(_:observe:)' to make state observation explicit.
613+
614+
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:
615+
616+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
617+
"""
564618
)
565619
@available(
566620
tvOS,
567621
deprecated: 9999.0,
568-
message: "Use 'init(_:observe:)' to make state observation explicit."
622+
message: """
623+
Use 'init(_:observe:)' to make state observation explicit.
624+
625+
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:
626+
627+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
628+
"""
569629
)
570630
@available(
571631
watchOS,
572632
deprecated: 9999.0,
573-
message: "Use 'init(_:observe:)' to make state observation explicit."
633+
message: """
634+
Use 'init(_:observe:)' to make state observation explicit.
635+
636+
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:
637+
638+
https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/performance#View-stores
639+
"""
574640
)
575641
public convenience init(_ store: Store<ViewState, ViewAction>) {
576642
self.init(store, removeDuplicates: ==)

0 commit comments

Comments
 (0)