Skip to content

Commit df92841

Browse files
authored
Force WithViewStore to be a view. (#1910)
1 parent 91e2bea commit df92841

File tree

3 files changed

+1
-456
lines changed

3 files changed

+1
-456
lines changed

Sources/ComposableArchitecture/Internal/Deprecations.swift

Lines changed: 0 additions & 383 deletions
Original file line numberDiff line numberDiff line change
@@ -118,389 +118,6 @@ extension ReducerProtocol {
118118
}
119119
#endif
120120

121-
// MARK: - Deprecated after 0.40.0:
122-
123-
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
124-
extension WithViewStore: AccessibilityRotorContent where Content: AccessibilityRotorContent {
125-
/// Initializes a structure that transforms a store into an observable view store in order to
126-
/// compute accessibility rotor content from store state.
127-
///
128-
/// - Parameters:
129-
/// - store: A store.
130-
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
131-
/// are equal, repeat view computations are removed,
132-
/// - content: A function that can generate content from a view store.
133-
@available(
134-
*,
135-
deprecated,
136-
message:
137-
"""
138-
For compiler performance, using "WithViewStore" from an accessibility rotor content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
139-
140-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
141-
"""
142-
)
143-
public init(
144-
_ store: Store<ViewState, ViewAction>,
145-
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
146-
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
147-
Content,
148-
file: StaticString = #fileID,
149-
line: UInt = #line
150-
) {
151-
self.init(
152-
store: store,
153-
removeDuplicates: isDuplicate,
154-
content: content,
155-
file: file,
156-
line: line
157-
)
158-
}
159-
}
160-
161-
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
162-
extension WithViewStore where ViewState: Equatable, Content: AccessibilityRotorContent {
163-
/// Initializes a structure that transforms a store into an observable view store in order to
164-
/// compute accessibility rotor content from equatable store state.
165-
///
166-
/// - Parameters:
167-
/// - store: A store of equatable state.
168-
/// - content: A function that can generate content from a view store.
169-
@available(
170-
*,
171-
deprecated,
172-
message:
173-
"""
174-
For compiler performance, using "WithViewStore" from an accessibility rotor content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
175-
176-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
177-
"""
178-
)
179-
public init(
180-
_ store: Store<ViewState, ViewAction>,
181-
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
182-
Content,
183-
file: StaticString = #fileID,
184-
line: UInt = #line
185-
) {
186-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
187-
}
188-
}
189-
190-
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
191-
extension WithViewStore where ViewState == Void, Content: AccessibilityRotorContent {
192-
/// Initializes a structure that transforms a store into an observable view store in order to
193-
/// compute accessibility rotor content from void store state.
194-
///
195-
/// - Parameters:
196-
/// - store: A store of equatable state.
197-
/// - content: A function that can generate content from a view store.
198-
@available(
199-
*,
200-
deprecated,
201-
message:
202-
"""
203-
For compiler performance, using "WithViewStore" from an accessibility rotor content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
204-
205-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
206-
"""
207-
)
208-
public init(
209-
_ store: Store<ViewState, ViewAction>,
210-
file: StaticString = #fileID,
211-
line: UInt = #line,
212-
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
213-
Content
214-
) {
215-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
216-
}
217-
}
218-
219-
@available(iOS 14, macOS 11, *)
220-
@available(tvOS, unavailable)
221-
@available(watchOS, unavailable)
222-
extension WithViewStore: Commands where Content: Commands {
223-
/// Initializes a structure that transforms a store into an observable view store in order to
224-
/// compute commands from store state.
225-
///
226-
/// - Parameters:
227-
/// - store: A store.
228-
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
229-
/// are equal, repeat view computations are removed,
230-
/// - content: A function that can generate content from a view store.
231-
@available(
232-
*,
233-
deprecated,
234-
message:
235-
"""
236-
For compiler performance, using "WithViewStore" from a command builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
237-
238-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
239-
"""
240-
)
241-
public init(
242-
_ store: Store<ViewState, ViewAction>,
243-
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
244-
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
245-
file: StaticString = #fileID,
246-
line: UInt = #line
247-
) {
248-
self.init(
249-
store: store,
250-
removeDuplicates: isDuplicate,
251-
content: content,
252-
file: file,
253-
line: line
254-
)
255-
}
256-
}
257-
258-
@available(iOS 14, macOS 11, *)
259-
@available(tvOS, unavailable)
260-
@available(watchOS, unavailable)
261-
extension WithViewStore where ViewState: Equatable, Content: Commands {
262-
/// Initializes a structure that transforms a store into an observable view store in order to
263-
/// compute commands from equatable store state.
264-
///
265-
/// - Parameters:
266-
/// - store: A store of equatable state.
267-
/// - content: A function that can generate content from a view store.
268-
@available(
269-
*,
270-
deprecated,
271-
message:
272-
"""
273-
For compiler performance, using "WithViewStore" from a command builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
274-
275-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
276-
"""
277-
)
278-
public init(
279-
_ store: Store<ViewState, ViewAction>,
280-
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
281-
file: StaticString = #fileID,
282-
line: UInt = #line
283-
) {
284-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
285-
}
286-
}
287-
288-
@available(iOS 14, macOS 11, *)
289-
@available(tvOS, unavailable)
290-
@available(watchOS, unavailable)
291-
extension WithViewStore where ViewState == Void, Content: Commands {
292-
/// Initializes a structure that transforms a store into an observable view store in order to
293-
/// compute commands from void store state.
294-
///
295-
/// - Parameters:
296-
/// - store: A store of equatable state.
297-
/// - content: A function that can generate content from a view store.
298-
@available(
299-
*,
300-
deprecated,
301-
message:
302-
"""
303-
For compiler performance, using "WithViewStore" from a command builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
304-
305-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
306-
"""
307-
)
308-
public init(
309-
_ store: Store<ViewState, ViewAction>,
310-
file: StaticString = #fileID,
311-
line: UInt = #line,
312-
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
313-
) {
314-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
315-
}
316-
}
317-
318-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
319-
extension WithViewStore: Scene where Content: Scene {
320-
/// Initializes a structure that transforms a store into an observable view store in order to
321-
/// compute scenes from store state.
322-
///
323-
/// - Parameters:
324-
/// - store: A store.
325-
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
326-
/// are equal, repeat view computations are removed,
327-
/// - content: A function that can generate content from a view store.
328-
@available(
329-
*,
330-
deprecated,
331-
message:
332-
"""
333-
For compiler performance, using "WithViewStore" from a scene builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
334-
335-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
336-
"""
337-
)
338-
public init(
339-
_ store: Store<ViewState, ViewAction>,
340-
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
341-
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
342-
file: StaticString = #fileID,
343-
line: UInt = #line
344-
) {
345-
self.init(
346-
store: store,
347-
removeDuplicates: isDuplicate,
348-
content: content,
349-
file: file,
350-
line: line
351-
)
352-
}
353-
}
354-
355-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
356-
extension WithViewStore where ViewState: Equatable, Content: Scene {
357-
/// Initializes a structure that transforms a store into an observable view store in order to
358-
/// compute scenes from equatable store state.
359-
///
360-
/// - Parameters:
361-
/// - store: A store of equatable state.
362-
/// - content: A function that can generate content from a view store.
363-
@available(
364-
*,
365-
deprecated,
366-
message:
367-
"""
368-
For compiler performance, using "WithViewStore" from a scene builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
369-
370-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
371-
"""
372-
)
373-
public init(
374-
_ store: Store<ViewState, ViewAction>,
375-
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
376-
file: StaticString = #fileID,
377-
line: UInt = #line
378-
) {
379-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
380-
}
381-
}
382-
383-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
384-
extension WithViewStore where ViewState == Void, Content: Scene {
385-
/// Initializes a structure that transforms a store into an observable view store in order to
386-
/// compute scenes from void store state.
387-
///
388-
/// - Parameters:
389-
/// - store: A store of equatable state.
390-
/// - content: A function that can generate content from a view store.
391-
@available(
392-
*,
393-
deprecated,
394-
message:
395-
"""
396-
For compiler performance, using "WithViewStore" from a scene builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
397-
398-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
399-
"""
400-
)
401-
public init(
402-
_ store: Store<ViewState, ViewAction>,
403-
file: StaticString = #fileID,
404-
line: UInt = #line,
405-
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
406-
) {
407-
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
408-
}
409-
}
410-
411-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
412-
extension WithViewStore: ToolbarContent where Content: ToolbarContent {
413-
/// Initializes a structure that transforms a store into an observable view store in order to
414-
/// compute toolbar content from store state.
415-
///
416-
/// - Parameters:
417-
/// - store: A store.
418-
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
419-
/// are equal, repeat view computations are removed,
420-
/// - content: A function that can generate content from a view store.
421-
@available(
422-
*,
423-
deprecated,
424-
message:
425-
"""
426-
For compiler performance, using "WithViewStore" from a toolbar content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
427-
428-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
429-
"""
430-
)
431-
public init(
432-
_ store: Store<ViewState, ViewAction>,
433-
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
434-
file: StaticString = #fileID,
435-
line: UInt = #line,
436-
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
437-
) {
438-
self.init(
439-
store: store,
440-
removeDuplicates: isDuplicate,
441-
content: content,
442-
file: file,
443-
line: line
444-
)
445-
}
446-
}
447-
448-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
449-
extension WithViewStore where ViewState: Equatable, Content: ToolbarContent {
450-
/// Initializes a structure that transforms a store into an observable view store in order to
451-
/// compute toolbar content from equatable store state.
452-
///
453-
/// - Parameters:
454-
/// - store: A store of equatable state.
455-
/// - content: A function that can generate content from a view store.
456-
@available(
457-
*,
458-
deprecated,
459-
message:
460-
"""
461-
For compiler performance, using "WithViewStore" from a toolbar content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
462-
463-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
464-
"""
465-
)
466-
public init(
467-
_ store: Store<ViewState, ViewAction>,
468-
file: StaticString = #fileID,
469-
line: UInt = #line,
470-
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
471-
) {
472-
self.init(store, removeDuplicates: ==, file: file, line: line, content: content)
473-
}
474-
}
475-
476-
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
477-
extension WithViewStore where ViewState == Void, Content: ToolbarContent {
478-
/// Initializes a structure that transforms a store into an observable view store in order to
479-
/// compute toolbar content from void store state.
480-
///
481-
/// - Parameters:
482-
/// - store: A store of equatable state.
483-
/// - content: A function that can generate content from a view store.
484-
@available(
485-
*,
486-
deprecated,
487-
message:
488-
"""
489-
For compiler performance, using "WithViewStore" from a toolbar content builder is no longer supported. Extract this "WithViewStore" to the parent view, instead, or observe your view store from an "@ObservedObject" property.
490-
491-
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
492-
"""
493-
)
494-
public init(
495-
_ store: Store<ViewState, ViewAction>,
496-
file: StaticString = #fileID,
497-
line: UInt = #line,
498-
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
499-
) {
500-
self.init(store, removeDuplicates: ==, file: file, line: line, content: content)
501-
}
502-
}
503-
504121
// MARK: - Deprecated after 0.39.1:
505122

506123
extension WithViewStore {

0 commit comments

Comments
 (0)