Back to Hero

HeroTransition

docs/docsets/Hero.docset/Contents/Resources/Documents/Classes/HeroTransition.html

1.6.416.8 KB
Original Source

HeroTransition

open class HeroTransition : NSObject
extension HeroTransition: UINavigationControllerDelegate
extension HeroTransition: UITabBarControllerDelegate
extension HeroTransition: UIViewControllerTransitioningDelegate
extension HeroTransition: UIViewControllerAnimatedTransitioning
extension HeroTransition: UIViewControllerInteractiveTransitioning

Undocumented

Show on GitHub

`

                delegate
                `

Undocumented

Declaration

Swift

public weak var delegate: HeroTransitionDelegate?

Show on GitHub

`

                defaultAnimation
                `

Undocumented

Declaration

Swift

public var defaultAnimation: HeroDefaultAnimationType

Show on GitHub

`

                containerColor
                `

Undocumented

Declaration

Swift

public var containerColor: UIColor

Show on GitHub

`

                isUserInteractionEnabled
                `

Undocumented

Declaration

Swift

public var isUserInteractionEnabled: Bool

Show on GitHub

`

                viewOrderingStrategy
                `

Undocumented

Declaration

Swift

public var viewOrderingStrategy: HeroViewOrderingStrategy

Show on GitHub

`

                defaultAnimationDirectionStrategy
                `

Undocumented

Declaration

Swift

public var defaultAnimationDirectionStrategy: HeroDefaultAnimationType.Strategy

Show on GitHub

`

                state
                `

Undocumented

Declaration

Swift

public internal(set) var state: HeroTransitionState { get set }

Show on GitHub

`

                isTransitioning
                `

Undocumented

Declaration

Swift

public var isTransitioning: Bool { get }

Show on GitHub

`

                isPresenting
                `

Undocumented

Declaration

Swift

public internal(set) var isPresenting: Bool { get }

Show on GitHub

`

                transitioning
                `

Undocumented

Declaration

Swift

public var transitioning: Bool { get }

Show on GitHub

`

                presenting
                `

Undocumented

Declaration

Swift

public var presenting: Bool { get }

Show on GitHub

`

                container
                `

container we created to hold all animating views, will be a subview of the transitionContainer when transitioning

Declaration

Swift

public internal(set) var container: UIView! { get }

Show on GitHub

`

                toViewController
                `

destination view controller

Declaration

Swift

public internal(set) var toViewController: UIViewController? { get }

Show on GitHub

`

                fromViewController
                `

source view controller

Declaration

Swift

public internal(set) var fromViewController: UIViewController? { get }

Show on GitHub

`

                context
                `

context object holding transition informations

Declaration

Swift

public internal(set) var context: HeroContext! { get }

Show on GitHub

`

                interactive
                `

whether or not we are handling transition interactively

Declaration

Swift

public var interactive: Bool { get }

Show on GitHub

`

                totalDuration
                `

max duration needed by the animators

Declaration

Swift

public internal(set) var totalDuration: TimeInterval { get }

Show on GitHub

`

                progress
                `

progress of the current transition. 0 if no transition is happening

Declaration

Swift

public internal(set) var progress: Double { get set }

Show on GitHub

`

                init()
                `

Undocumented

Declaration

Swift

public override init()

Show on GitHub

Observe Progress

`

                observeForProgressUpdate(observer:)
                `

Receive callbacks on each animation frame. Observers will be cleaned when transition completes

  • observer: the observer

Declaration

Swift

public func observeForProgressUpdate(observer: HeroProgressUpdateObserver)

Show on GitHub

`

                animate()
                `

Undocumented

Declaration

Swift

public func animate()

Show on GitHub

`

                complete(finished:)
                `

Undocumented

Declaration

Swift

public func complete(finished: Bool)

Show on GitHub

`

                transition(from:to:in:completion:)
                `

Undocumented

Declaration

Swift

func transition(from: UIViewController, to: UIViewController, in view: UIView, completion: ((Bool) -> Void)? = nil)

Show on GitHub

`

                update(_:)
                `

Update the progress for the interactive transition.

  • progress: the current progress, must be between 0…1

Declaration

Swift

public func update(_ percentageComplete: CGFloat)

Show on GitHub

`

                finish(animate:)
                `

Finish the interactive transition. Will stop the interactive transition and animate from the current state to the end state

Declaration

Swift

public func finish(animate: Bool = true)

Show on GitHub

`

                cancel(animate:)
                `

Cancel the interactive transition. Will stop the interactive transition and animate from the current state to the beginning state

Declaration

Swift

public func cancel(animate: Bool = true)

Show on GitHub

`

                apply(modifiers:to:)
                `

Override modifiers during an interactive animation.

For example:

Hero.shared.apply([.position(x:50, y:50)], to:view)

will set the view’s position to 50, 50

  • modifiers: the modifiers to override
  • view: the view to override to

Declaration

Swift

public func apply(modifiers: [HeroModifier], to view: UIView)

Show on GitHub

`

                changeTarget(modifiers:isDestination:to:)
                `

Override target state during an interactive animation.

For example:

Hero.shared.changeTarget([.position(x:50, y:50)], to:view)

will animate the view’s position to 50, 50 once finish(animate:) is called

  • modifiers: the modifiers to override
  • isDestination: if false, it changes the starting state
  • view: the view to override to

Declaration

Swift

public func changeTarget(modifiers: [HeroModifier], isDestination: Bool = true, to view: UIView)

Show on GitHub

`

                start()
                `

Undocumented

Declaration

Swift

public func start()

Show on GitHub

`

                navigationController(_:willShow:animated:)
                `

Undocumented

Declaration

Swift

@MainActor
public func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool)

Show on GitHub

`

                navigationController(_:didShow:animated:)
                `

Undocumented

Declaration

Swift

@MainActor
public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool)

Show on GitHub

`

                navigationController(_:animationControllerFor:from:to:)
                `

Undocumented

Declaration

Swift

@MainActor
public func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning?

Show on GitHub

`

                navigationController(_:interactionControllerFor:)
                `

Undocumented

Declaration

Swift

@MainActor
public func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

Show on GitHub

`

                tabBarController(_:shouldSelect:)
                `

Undocumented

Declaration

Swift

@MainActor
public func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool

Show on GitHub

`

                tabBarController(_:interactionControllerFor:)
                `

Undocumented

Declaration

Swift

@MainActor
public func tabBarController(_ tabBarController: UITabBarController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

Show on GitHub

`

                tabBarController(_:animationControllerForTransitionFrom:to:)
                `

Undocumented

Declaration

Swift

@MainActor
public func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning?

Show on GitHub

`

                animationController(forPresented:presenting:source:)
                `

Undocumented

Declaration

Swift

@MainActor
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning?

Show on GitHub

`

                animationController(forDismissed:)
                `

Undocumented

Declaration

Swift

@MainActor
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?

Show on GitHub

`

                interactionControllerForDismissal(using:)
                `

Undocumented

Declaration

Swift

@MainActor
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

Show on GitHub

`

                interactionControllerForPresentation(using:)
                `

Undocumented

Declaration

Swift

@MainActor
public func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

Show on GitHub

`

                animateTransition(using:)
                `

Undocumented

Declaration

Swift

@MainActor
public func animateTransition(using context: UIViewControllerContextTransitioning)

Show on GitHub

`

                transitionDuration(using:)
                `

Undocumented

Declaration

Swift

@MainActor
public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval

Show on GitHub

`

                animationEnded(_:)
                `

Undocumented

Declaration

Swift

@MainActor
public func animationEnded(_ transitionCompleted: Bool)

Show on GitHub

`

                wantsInteractiveStart
                `

Undocumented

Declaration

Swift

@MainActor
public var wantsInteractiveStart: Bool { get }

Show on GitHub

`

                startInteractiveTransition(_:)
                `

Undocumented

Declaration

Swift

@MainActor
public func startInteractiveTransition(_ transitionContext: UIViewControllerContextTransitioning)

Show on GitHub