Skip to Main Content
Player Logo
PlayerPlugins

Transition Plugin

The TransitionPlugin allows for specifying transitions for when Player loads a flow, and for transition between views in the same flow.

CocoaPods

Add the subspec to your Podfile
pod 'PlayerUI/TransitionPlugin'

Swift Usage

SwiftUIPlayer(flow: flowString, plugins: [TransitionPlugin(popTransition: .pop)], result: $resultBinding)

Customizing Transitions

To specify different transition, just supply a PlayerViewTransition to the plugin initializer:
let customTransition = PlayerViewTransition(
  transition: AnyTransition.opacity,
  animationCurve: Animation.linear
)
let plugin = TransitionPlugin(
  stateTransition: customTransition,
  pushTransition: customTransition,
  popTransition: customTransition
)

Default Transitions

By default there are 5 transitions included with the SwiftUIPlayer:
/// Transition that slides views in from the trailing edge and out from to the leading edge of the screen
PlayerViewTransition.slideInSlideOut

/// Transition that slides views in from the trailing edge and fades out views on removal
PlayerViewTransition.slideInFadeOut

/// Transition that fades views in and slides out to the leading edge of the screen on removal
PlayerViewTransition.fadeInSlideOut

/// Transition that slides views in from the trailing edge and out from to the leading edge of the screen
PlayerViewTransition.push

/// Transition that slides views in from the leading edge and out from to the trailing edge of the screen
PlayerViewTransition.pop