Unwind Support & Snapshot Type Modifiers
0.1.4
- fix a bug where changing orientation doesn't affect previous VC. #60
- fix a bug where the presented view controller has incorrect frame. #63, #56
- New snapshot type modifiers:
-
useOptimizedSnapshot
With this modifier, Hero will create snapshot optimized for different view type when animating.
For custom views or views with masking, useOptimizedSnapshot might create snapshots
that appear differently than the actual view.
In that case, use .useNormalSnapshot or .useSlowRenderSnapshot to disable the optimization. -
useNormalSnapshot
Create snapshot using snapshotView(afterScreenUpdates:).
-
useLayerRenderSnapshot
Create snapshot using layer.render(in: currentContext).
This is slower than .useNormalSnapshot but gives more accurate snapshot for some views (eg. UIStackView). -
useNoSnapshot
Force Hero to not create any snapshot when animating this view. Hence Hero will animate on the view directly.
This will mess up the view hierarchy. Therefore, view controllers have to rebuild its view structure after the transition finishes.
-
- New navigation extension on UIViewController (mainly to support unwinding):
-
func hero_dismissViewController()
Dismiss the current view controller with animation. Will perform a navigationController.popViewController
if the current view controller is contained inside a navigationController. -
func hero_replaceViewController(with:UIViewController)
Replace the current view controller with another VC on the navigation/modal stack.
-
func hero_unwindToRootViewController()
Unwind to the root view controller using Hero.
-
func hero_unwindToViewController(_ toViewController:)
Unwind to a specific view controller using Hero.
-
func hero_unwindToViewController(withSelector: Selector)
Unwind to a view controller that responds to the given selector using Hero.
-
func hero_unwindToViewController(withClass: AnyClass)
Unwind to a view controller with given class using Hero.
-
func hero_unwindToViewController(withMatchBlock: (UIViewController) -> Bool)
Unwind to a view controller that the match block returns true on.
-