Move WithViewStore deprecations to Deprecations.swift (#1346)

This commit is contained in:
Brandon Williams
2022-09-07 15:12:00 -04:00
committed by GitHub
parent eb43df7d09
commit 046133ffd8
2 changed files with 397 additions and 402 deletions

View File

@@ -119,7 +119,7 @@ public struct WithViewStore<ViewState, ViewAction, Content> {
#endif
@_StateObject private var viewStore: ViewStore<ViewState, ViewAction>
fileprivate init(
init(
store: @autoclosure @escaping () -> Store<ViewState, ViewAction>,
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
@@ -422,392 +422,3 @@ where
self.viewStore.state
}
}
// MARK: - AccessibilityRotorContent
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
extension WithViewStore: AccessibilityRotorContent where Content: AccessibilityRotorContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute accessibility rotor content from store state.
///
/// - Parameters:
/// - store: A store.
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
/// are equal, repeat view computations are removed,
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(
store: store,
removeDuplicates: isDuplicate,
content: content,
file: file,
line: line
)
}
}
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
extension WithViewStore where ViewState: Equatable, Content: AccessibilityRotorContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute accessibility rotor content from equatable store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
extension WithViewStore where ViewState == Void, Content: AccessibilityRotorContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute accessibility rotor content from void store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
file: StaticString = #fileID,
line: UInt = #line,
@AccessibilityRotorContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) ->
Content
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
// MARK: - Commands
@available(iOS 14, macOS 11, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension WithViewStore: Commands where Content: Commands {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute commands from store state.
///
/// - Parameters:
/// - store: A store.
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
/// are equal, repeat view computations are removed,
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(
store: store,
removeDuplicates: isDuplicate,
content: content,
file: file,
line: line
)
}
}
@available(iOS 14, macOS 11, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension WithViewStore where ViewState: Equatable, Content: Commands {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute commands from equatable store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
@available(iOS 14, macOS 11, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension WithViewStore where ViewState == Void, Content: Commands {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute commands from void store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
file: StaticString = #fileID,
line: UInt = #line,
@CommandsBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
// MARK: - Scene
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore: Scene where Content: Scene {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute scenes from store state.
///
/// - Parameters:
/// - store: A store.
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
/// are equal, repeat view computations are removed,
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(
store: store,
removeDuplicates: isDuplicate,
content: content,
file: file,
line: line
)
}
}
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore where ViewState: Equatable, Content: Scene {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute scenes from equatable store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
file: StaticString = #fileID,
line: UInt = #line
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore where ViewState == Void, Content: Scene {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute scenes from void store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
file: StaticString = #fileID,
line: UInt = #line,
@SceneBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
) {
self.init(store, removeDuplicates: ==, content: content, file: file, line: line)
}
}
// MARK: - ToolbarContent
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore: ToolbarContent where Content: ToolbarContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute toolbar content from store state.
///
/// - Parameters:
/// - store: A store.
/// - isDuplicate: A function to determine when two `ViewState` values are equal. When values
/// are equal, repeat view computations are removed,
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
file: StaticString = #fileID,
line: UInt = #line,
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
) {
self.init(
store: store,
removeDuplicates: isDuplicate,
content: content,
file: file,
line: line
)
}
}
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore where ViewState: Equatable, Content: ToolbarContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute toolbar content from equatable store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
file: StaticString = #fileID,
line: UInt = #line,
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
) {
self.init(store, removeDuplicates: ==, file: file, line: line, content: content)
}
}
@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)
extension WithViewStore where ViewState == Void, Content: ToolbarContent {
/// Initializes a structure that transforms a store into an observable view store in order to
/// compute toolbar content from void store state.
///
/// - Parameters:
/// - store: A store of equatable state.
/// - content: A function that can generate content from a view store.
@available(
*,
deprecated,
message:
"""
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.
See the documentation for "WithViewStore" (https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/viewstore#overview) for more information.
"""
)
public init(
_ store: Store<ViewState, ViewAction>,
file: StaticString = #fileID,
line: UInt = #line,
@ToolbarContentBuilder content: @escaping (ViewStore<ViewState, ViewAction>) -> Content
) {
self.init(store, removeDuplicates: ==, file: file, line: line, content: content)
}
}