docs/Classes/HeroPlugin.html
open class HeroPlugin : NSObject, HeroPreprocessor, HeroAnimator
Undocumented
`
hero
`
Undocumented
Swift
weak public var hero: HeroTransition!
`
context
`
Undocumented
Swift
public var context: HeroContext! { get }
`
requirePerFrameCallback
`
Determines whether or not to receive seekTo callback on every frame.
Default is false.
When requirePerFrameCallback is false , the plugin needs to start its own animations inside animate & resume The seekTo method is only being called during an interactive transition.
When requirePerFrameCallback is true , the plugin will receive seekTo callback on every animation frame. Hence it is possible for the plugin to do per-frame animations without implementing animate & resume
Swift
open var requirePerFrameCallback: Bool
`
init()
`
Undocumented
Swift
public override required init()
`
process(fromViews:toViews:)
`
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"]
Swift
open func process(fromViews: [UIView], toViews: [UIView])
| context |
object holding all parsed and changed modifiers,
|
| fromViews |
A flattened list of all views from source ViewController
|
| toViews |
A flattened list of all views from destination ViewController
|
`
canAnimate(view:appearing:)
`
Swift
open func canAnimate(view: UIView, appearing: Bool) -> Bool
| context |
object holding all parsed and changed modifiers,
|
| view |
the view to check whether or not the plugin can handle the animation
|
| appearing |
true 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 true if the plugin can handle animating the view.
`
animate(fromViews:toViews:)
`
Perform the animation.
Note: views in fromViews & toViews are hidden already. Unhide then if you need to take snapshots.
Swift
open func animate(fromViews: [UIView], toViews: [UIView]) -> TimeInterval
| context |
object holding all parsed and changed modifiers,
|
| fromViews |
A flattened list of all views from source ViewController (filtered by canAnimate)
|
| toViews |
A flattened list of all views from destination ViewController (filtered by canAnimate)
|
The duration needed to complete the animation
`
clean()
`
Called when all animations are completed.
Should perform cleanup and release any reference
Swift
open func clean()
`
seekTo(timePassed:)
`
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
Swift
open func seekTo(timePassed: TimeInterval)
| timePassed |
time of the animation to seek to.
|
`
resume(timePassed:reverse:)
`
For supporting interactive animation only.
This method is called when an interactive animation is ended The plugin should resume the animation.
seekToSwift
open func resume(timePassed: TimeInterval, reverse: Bool) -> TimeInterval
`
apply(state:to:)
`
For supporting interactive animation only.
This method is called when user wants to override animation modifiers during an interactive animation
Swift
open func apply(state: HeroTargetState, to view: UIView)
| state |
the target state to override
|
| view |
the view to override
|
`
changeTarget(state:isDestination:to:)
`
Undocumented
Swift
open func changeTarget(state: HeroTargetState, isDestination: Bool, to view: UIView)
`
isEnabled
`
Undocumented
Swift
public static var isEnabled: Bool { get set }
`
enable()
`
Undocumented
Swift
public static func enable()
`
disable()
`
Undocumented
Swift
public static func disable()