Skip to content

Releases: creastel/ios-card-transition

Adding CSCardTransitionProperties

01 Sep 13:11
Compare
Choose a tag to compare

You can now use CSCardTransitionProperties to customize your transition easily and debug it.

Customize your transition

You can customize all of the properties below simply by providing a custom instance of CSCardTransitionProperties to the Presented View Controller. For instance:

extension YourViewController: CSCardPresentedView {
	var cardTransitionProperties: CSCardTransitionProperties { 
		return CSCardTransitionProperties(
			/// Presenting animation properties
			presentPositioningDuration: TimeInterval, 
			presentResizingDuration: TimeInterval, 
			presentStatusStyleUpdateDuration: TimeInterval, 
			/// Dismissing animation properties
			dismissPositioningDuration: TimeInterval, 
			dismissResizingDuration: TimeInterval, 
			dismissBlurDuration: TimeInterval, 
			dismissStatusStyleUpdateDuration: TimeInterval, 
			/// Fade transition duration between presented card view and presenter card view
			dismissFadeCardAnimationTime: TimeInterval, 
			/// How far should the user swipe to dismiss the view
			preDismissingTransitionProgressPortion: CGFloat, 
			/// Cancel animation duration
			cancelTransitionResizingDuration: TimeInterval, 
			/// Blurred background color during transition
			transitionBackgroundColor: UIColor
		)
	}
}

Note: all of these properties have default values, so you can skip the ones you don't want to change in the instance creation.

Debug your transition

The transition must be quick in production, but slow it down (to 1/10) during its development so you can easily see what is working and what still needs some improvements. You can enable debug mode by simply providing a debug instance of the CSCardTransitionProperties to the Presented View Controller.

extension YourViewController: CSCardPresentedView {
	var cardTransitionProperties: CSCardTransitionProperties { 
		return .debug
	}
}

Adding debug mode

25 Jan 22:26
Compare
Choose a tag to compare

Slow your animation transitions down (to 1/10) during their development so you can easily see what is working and what still needs some improvements. You can enable debug mode by simply writing the following line anywhere in your code, before your transition happens.

CSCardTransition.debug = true

Adding CardView Parameter

25 Jan 19:33
Compare
Choose a tag to compare

You can now access the parent view controller's cardView from the presented view controller when starting the transition. Permitting you to adjust your presenting animation.

/// Called when the transition to this view controller just started.
/// - Parameter cardView: The UIView used in the parent view controller to start the transitinon.
func cardPresentedViewDidStartPresenting(from cardView: UIView)

Initial Release

25 Jan 19:28
Compare
Choose a tag to compare

CSCardTransition_light

CSCardTransition

CSCardTransition is a small library allowing you to create wonderful push and pop transition animations like in the App Store.
It works side by side with your navigation controller, and ensure that you only code what's necessary for your custom transition.