Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Animation structure to define sheet present / dismiss animations #26

Closed
mpospese opened this issue Apr 27, 2023 · 0 comments · Fixed by #28
Closed

Use new Animation structure to define sheet present / dismiss animations #26

mpospese opened this issue Apr 27, 2023 · 0 comments · Fixed by #28
Assignees
Labels
enhancement New feature or request

Comments

@mpospese
Copy link
Contributor

mpospese commented Apr 27, 2023

Intro

Y—CoreUI 1.6.0+ has a new Animation struct (used in Y—Snackbar) that lets us configure component animations without even needing to know the animation type (e.g. regular curve vs spring-dampening). We should adopt it for Y—BottomSheet's animations to allow increased customizations.

Task

  1. Replace the following three properties on BottomSheetController.Appearance
public var animationDuration: TimeInterval
public var presentAnimationCurve: UIView.AnimationOptions
public var dismissAnimationCurve: UIView.AnimationOptions

with two new properties:

public var presentAnimation: Animation
public var dismissAnimation: Animation
  1. Add an Animation+BottomSheet.swift file with the following default animations defined:
/// Default animation properties for bottom sheet
public extension Animation {
    /// Default animation for presenting bottom sheet (ease in)
    static let defaultPresent = Animation(curve: .regular(options: .curveEaseIn))

    /// Default animation for dismissing bottom sheet (ease out)
    static let defaultDismiss= Animation(curve: .regular(options: .curveEaseOut))
}
  1. In BottomSheetController.Appearance use the above defaults as the default parameters when initializing an Appearance object.

  2. Have the present and dismiss animators leverage these new appearance properties for their animations.

  3. Update unit tests for 100% coverage and properly testing the new functionality.

Note: when Reduced Motion is on, we will ignore the provided curve (it might be spring-dampening which does not make sense for a cross-dissolve) and replace it with a default easing curve (see Y—Snackbar).

@mpospese mpospese added the enhancement New feature or request label Apr 27, 2023
@mpospese mpospese self-assigned this May 4, 2023
@mpospese mpospese linked a pull request May 4, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

1 participant