You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add a slide-inverse animation also? I mean in a ltr application from left to right or if you prefer from leading to trailing.
It would be a convenient feature to have out of the box.
It's really fast to code too, I made it in my project like this:
import AtomicTransition
import SwiftUI
import NavigationTransitions
extension AnyNavigationTransition {
/// A transition that moves both views in and out along the specified axis.
///
/// This transition:
/// - Pushes views left-to-right and pops views left-to-right when `axis` is `horizontal`.
/// - Pushes views top-to-bottom and pops views top-to-bottom when `axis` is `vertical`.
public static func inverseSlide(axis: Axis) -> Self {
.init(InverseSlide(axis: axis))
}
}
extension AnyNavigationTransition {
/// Equivalent to `slide(axis: .horizontal)`.
@inlinable
public static var slide: Self {
.inverseSlide(axis: .horizontal)
}
}
/// A transition that moves both views in and out along the specified axis.
///
/// This transition:
/// - Pushes views left-to-right and pops views left-to-right when `axis` is `horizontal`.
/// - Pushes views top-to-bottom and pops views top-to-bottom when `axis` is `vertical`.
public struct InverseSlide: NavigationTransition {
private let axis: Axis
public init(axis: Axis) {
self.axis = axis
}
/// Equivalent to `Move(axis: .horizontal)`.
@inlinable
public init() {
self.init(axis: .horizontal)
}
public var body: some NavigationTransition {
switch axis {
case .horizontal:
MirrorPush {
OnInsertion {
Move(edge: .leading)
}
OnRemoval {
Move(edge: .trailing)
}
}
case .vertical:
MirrorPush {
OnInsertion {
Move(edge: .top)
}
OnRemoval {
Move(edge: .bottom)
}
}
}
}
}
extension InverseSlide: Hashable {}
The text was updated successfully, but these errors were encountered:
Would it be possible to add a slide-inverse animation also? I mean in a ltr application from left to right or if you prefer from leading to trailing.
It would be a convenient feature to have out of the box.
It's really fast to code too, I made it in my project like this:
The text was updated successfully, but these errors were encountered: