mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-24 12:14:25 +01:00
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Silence test warnings * wip * wip * wip * wip * wip * wip * wip * Revert "wip" This reverts commited6cc24adb. * Revert "Revert "wip"" This reverts commit8358990b1a. * wip * wip * wip * wip * wip * update a bunch of docs * wip * wip * wip * fix * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Kill integration tests for now * wip * wip * wip * wip * updating docs for @Reducer macro * replaced more Reducer protocols with @Reducer * Fixed some broken docc references * wip * Some @Reducer docs * more docs * convert some old styles to new style * wip * wip * wip * wip * wip * wip * wip * bump * update tutorials to use body * update tutorials to use DML on destination state enum * Add diagnostic * wip * updated a few more tests * wip * wip * Add another gotcha * wip * wip * wip * Add dynamic lookup to presentation state/action * wip * wip * Better lookup * wip * wip * wip * IdentifiedAction * wip * wip * wip * wip * wip * wip * wip * wip * wip * fixes * wip * wip * added migration guide for new scope operation * migration guide for new navigation view modifiers * wip * fix * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * fix * wip * wip * remove for now * wip * wip * simplify scope * wip * updated some docs * migration guides * more migration guide * fix ci * fix * soft deprecate all apis using AnyCasePath * wip * Fix * fix tests * updated tests * swift-format 509 compatibility * wip * wip * Update Sources/ComposableArchitecture/Macros.swift Co-authored-by: Mateusz Bąk <bakmatthew@icloud.com> * wip * wip * update optional state case study * remove initializer * Don't use @State for BasicsView integration demo * fix tests * remove reduce diagnostics for now * diagnose error not warning * Update Sources/ComposableArchitecture/Macros.swift Co-authored-by: Jesse Tipton <jesse@jessetipton.com> * wip * move integration tests to cron * Revert "move integration tests to cron" This reverts commitf9bdf2f04b. * disable flakey tests on CI * wip * wip * fix migration guide * fix docs * fix deprecation messages * wip * wip * missing deprecation * soft * wip * update migration guide * Fix resolved * update migration guide * fix test * format * wip * fix * wip * wip * wip * wip * wip * wip * wip * wip * fix * wip * wip --------- Co-authored-by: Brandon Williams <mbrandonw@hey.com> Co-authored-by: Mateusz Bąk <bakmatthew@icloud.com> Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com> Co-authored-by: Jesse Tipton <jesse@jessetipton.com>
88 lines
4.7 KiB
Swift
88 lines
4.7 KiB
Swift
import SwiftUI
|
|
|
|
#if !os(macOS)
|
|
@available(iOS 14, tvOS 14, watchOS 7, *)
|
|
@available(macOS, unavailable)
|
|
extension View {
|
|
/// Presents a modal view that covers as much of the screen as possible using the store you
|
|
/// provide as a data source for the sheet's content.
|
|
///
|
|
/// > This is a Composable Architecture-friendly version of SwiftUI's `fullScreenCover` view
|
|
/// > modifier.
|
|
///
|
|
/// - Parameters:
|
|
/// - store: A store that is focused on ``PresentationState`` and ``PresentationAction`` for
|
|
/// a modal. When `store`'s state is non-`nil`, the system passes a store of unwrapped `State`
|
|
/// and `Action` to the modifier's closure. You use this store to power the content in a sheet
|
|
/// you create that the system displays to the user. If `store`'s state is `nil`-ed out, the
|
|
/// system dismisses the currently displayed sheet.
|
|
/// - onDismiss: The closure to execute when dismissing the modal view.
|
|
/// - content: A closure returning the content of the modal view.
|
|
public func fullScreenCover<State, Action, Content: View>(
|
|
store: Store<PresentationState<State>, PresentationAction<Action>>,
|
|
onDismiss: (() -> Void)? = nil,
|
|
@ViewBuilder content: @escaping (_ store: Store<State, Action>) -> Content
|
|
) -> some View {
|
|
self.presentation(store: store) { `self`, $item, destination in
|
|
self.fullScreenCover(item: $item, onDismiss: onDismiss) { _ in
|
|
destination(content)
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Presents a modal view that covers as much of the screen as possible using the store you
|
|
/// provide as a data source for the sheet's content.
|
|
///
|
|
/// > This is a Composable Architecture-friendly version of SwiftUI's `fullScreenCover` view
|
|
/// > modifier.
|
|
///
|
|
/// - Parameters:
|
|
/// - store: A store that is focused on ``PresentationState`` and ``PresentationAction`` for
|
|
/// a modal. When `store`'s state is non-`nil`, the system passes a store of unwrapped `State`
|
|
/// and `Action` to the modifier's closure. You use this store to power the content in a sheet
|
|
/// you create that the system displays to the user. If `store`'s state is `nil`-ed out, the
|
|
/// system dismisses the currently displayed sheet.
|
|
/// - toDestinationState: A transformation to extract modal state from the presentation state.
|
|
/// - fromDestinationAction: A transformation to embed modal actions into the presentation
|
|
/// action.
|
|
/// - onDismiss: The closure to execute when dismissing the modal view.
|
|
/// - content: A closure returning the content of the modal view.
|
|
@available(
|
|
iOS, deprecated: 9999,
|
|
message:
|
|
"Further scope the store into the 'state' and 'action' cases, instead. For more information, see the following article:\n\nhttps://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.5#Enum-driven-navigation-APIs"
|
|
)
|
|
@available(
|
|
macOS, deprecated: 9999,
|
|
message:
|
|
"Further scope the store into the 'state' and 'action' cases, instead. For more information, see the following article:\n\nhttps://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.5#Enum-driven-navigation-APIs"
|
|
)
|
|
@available(
|
|
tvOS, deprecated: 9999,
|
|
message:
|
|
"Further scope the store into the 'state' and 'action' cases, instead. For more information, see the following article:\n\nhttps://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.5#Enum-driven-navigation-APIs"
|
|
)
|
|
@available(
|
|
watchOS, deprecated: 9999,
|
|
message:
|
|
"Further scope the store into the 'state' and 'action' cases, instead. For more information, see the following article:\n\nhttps://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.5#Enum-driven-navigation-APIs"
|
|
)
|
|
public func fullScreenCover<State, Action, DestinationState, DestinationAction, Content: View>(
|
|
store: Store<PresentationState<State>, PresentationAction<Action>>,
|
|
state toDestinationState: @escaping (_ state: State) -> DestinationState?,
|
|
action fromDestinationAction: @escaping (_ destinationAction: DestinationAction) -> Action,
|
|
onDismiss: (() -> Void)? = nil,
|
|
@ViewBuilder content: @escaping (_ store: Store<DestinationState, DestinationAction>) ->
|
|
Content
|
|
) -> some View {
|
|
self.presentation(
|
|
store: store, state: toDestinationState, action: fromDestinationAction
|
|
) { `self`, $item, destination in
|
|
self.fullScreenCover(item: $item, onDismiss: onDismiss) { _ in
|
|
destination(content)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|