-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
107 deletions.
There are no files selected for viewing
36 changes: 0 additions & 36 deletions
36
Sources/AtomicTransition/Asymmetric.swift → Sources/AtomicTransition/On.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
...ces/NavigationTransition/Asymmetric.swift → Sources/NavigationTransition/On.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/// Used to isolate the push portion of a full `NavigationTransition` and execute it on push, ignoring the pop portion. | ||
public struct PickPush<Transition: NavigationTransition>: NavigationTransition { | ||
private let transition: Transition | ||
|
||
public init(@NavigationTransitionBuilder transition: () -> Transition) { | ||
self.transition = transition() | ||
} | ||
|
||
public func transition( | ||
from fromView: TransientView, | ||
to toView: TransientView, | ||
for operation: TransitionOperation, | ||
in container: Container | ||
) { | ||
switch operation { | ||
case .push: | ||
transition.transition(from: fromView, to: toView, for: operation, in: container) | ||
case .pop: | ||
return | ||
} | ||
} | ||
} | ||
|
||
extension PickPush: Equatable where Transition: Equatable {} | ||
extension PickPush: Hashable where Transition: Hashable {} | ||
|
||
/// Used to isolate the pop portion of a full `NavigationTransition` and execute it on pop, ignoring the push portion. | ||
public struct PickPop<Transition: NavigationTransition>: NavigationTransition { | ||
private let transition: Transition | ||
|
||
public init(@NavigationTransitionBuilder transition: () -> Transition) { | ||
self.transition = transition() | ||
} | ||
|
||
public func transition( | ||
from fromView: TransientView, | ||
to toView: TransientView, | ||
for operation: TransitionOperation, | ||
in container: Container | ||
) { | ||
switch operation { | ||
case .push: | ||
return | ||
case .pop: | ||
transition.transition(from: fromView, to: toView, for: operation, in: container) | ||
} | ||
} | ||
} | ||
|
||
extension PickPop: Equatable where Transition: Equatable {} | ||
extension PickPop: Hashable where Transition: Hashable {} |
22 changes: 0 additions & 22 deletions
22
...omicTransitionTests/AsymmetricTests.swift → Tests/AtomicTransitionTests/OnTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters