-
Undocumented
Declaration
Swift
weak public var hero: HeroTransition! -
Undocumented
Declaration
Swift
public var context: HeroContext! { get } -
Determines whether or not to receive
seekTocallback on every frame.Default is false.
When requirePerFrameCallback is false, the plugin needs to start its own animations inside
animate&resumeTheseekTomethod is only being called during an interactive transition.When requirePerFrameCallback is true, the plugin will receive
seekTocallback on every animation frame. Hence it is possible for the plugin to do per-frame animations without implementinganimate&resumeDeclaration
Swift
open var requirePerFrameCallback: Bool -
Undocumented
Declaration
Swift
public override required init() -
Called before any animation. Override this method when you want to preprocess modifiers for views
To check a view’s modifiers:
context[view] context[view, "modifierName"]To set a view’s modifiers:
context[view] = [("modifier1", ["parameter1"]), ("modifier2", [])] context[view, "modifier1"] = ["parameter1", "parameter2"]Declaration
Swift
open func process(fromViews: [UIView], toViews: [UIView])Parameters
contextobject holding all parsed and changed modifiers,
fromViewsA flattened list of all views from source ViewController
toViewsA flattened list of all views from destination ViewController
-
Declaration
Swift
open func canAnimate(view: UIView, appearing: Bool) -> BoolParameters
contextobject holding all parsed and changed modifiers,
viewthe view to check whether or not the plugin can handle the animation
appearingtrue if the view is appearing(i.e. a view in destination ViewController) If return true, Hero won’t animate and won’t let any other plugins animate this view. The view will also be hidden automatically during the animation.
Return Value
return true if the plugin can handle animating the view.
-
Perform the animation.
Note: views in
fromViews&toViewsare hidden already. Unhide then if you need to take snapshots.Declaration
Swift
open func animate(fromViews: [UIView], toViews: [UIView]) -> TimeIntervalParameters
contextobject holding all parsed and changed modifiers,
fromViewsA flattened list of all views from source ViewController (filtered by
canAnimate)toViewsA flattened list of all views from destination ViewController (filtered by
canAnimate)Return Value
The duration needed to complete the animation
-
Called when all animations are completed.
Should perform cleanup and release any reference
Declaration
Swift
open func clean() -
For supporting interactive animation only.
This method is called when an interactive animation is in place The plugin should pause the animation, and seek to the given progress
Declaration
Swift
open func seekTo(timePassed: TimeInterval)Parameters
timePassedtime of the animation to seek to.
-
For supporting interactive animation only.
This method is called when an interactive animation is ended The plugin should resume the animation.
- timePassed: will be the same value since last
seekTo - reverse: a boolean value indicating whether or not the animation should reverse
Declaration
Swift
open func resume(timePassed: TimeInterval, reverse: Bool) -> TimeInterval - timePassed: will be the same value since last
-
For supporting interactive animation only.
This method is called when user wants to override animation modifiers during an interactive animation
Declaration
Swift
open func apply(state: HeroTargetState, to view: UIView)Parameters
statethe target state to override
viewthe view to override
-
Undocumented
Declaration
Swift
open func changeTarget(state: HeroTargetState, isDestination: Bool, to view: UIView) -
Undocumented
Declaration
Swift
public static var isEnabled: Bool { get set } -
Undocumented
Declaration
Swift
public static func enable() -
Undocumented
Declaration
Swift
public static func disable()
View on GitHub
Install in Dash
HeroPlugin Class Reference