Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
Syntax consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
benguild committed Oct 4, 2019
1 parent c6e6388 commit 87fa253
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions PullToDismissTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ public class PullToDismissTransition: UIPercentDrivenInteractiveTransition {
transitionDelegateObservation?.invalidate()
}

public init(viewController: UIViewController, transitionType: PullToDismissTransitionType = .slideStatic, animationOptions: UIView.AnimationOptions = [.curveLinear]) {
public init(
viewController: UIViewController,
animationOptions: UIView.AnimationOptions = [.curveLinear],
transitionType: PullToDismissTransitionType = .slideStatic
) {
self.animationOptions = animationOptions
self.transitionType = transitionType
self.viewController = viewController
self.animationOptions = animationOptions

super.init()
}
Expand Down Expand Up @@ -365,9 +369,12 @@ extension PullToDismissTransition: UIViewControllerAnimatedTransitioning {
if shouldRoundCorners {
scalingView.layer.masksToBounds = true

UIViewPropertyAnimator(duration: Const.scalingViewCornerRadiusToggleDuration, curve: .easeIn) {
UIViewPropertyAnimator(
duration: Const.scalingViewCornerRadiusToggleDuration,
curve: .easeIn
) {
scalingView.layer.cornerRadius = Const.scalingViewCornerRadius
}.startAnimation()
}.startAnimation()
}
}
}
Expand All @@ -379,15 +386,17 @@ extension PullToDismissTransition: UIViewControllerAnimatedTransitioning {
completionHandler: (() -> Void)? = nil
) {
if transitionContext.transitionWasCancelled, let scalingView = scalingView {

if #available(iOS 10.0, *) {
if scalingView.layer.cornerRadius > 0 {
viewController.view.layer.cornerRadius = scalingView.layer.cornerRadius
viewController.view.layer.masksToBounds = true

UIViewPropertyAnimator(duration: Const.scalingViewCornerRadiusToggleDuration, curve: .easeIn) {
UIViewPropertyAnimator(
duration: Const.scalingViewCornerRadiusToggleDuration,
curve: .easeIn
) {
viewController.view.layer.cornerRadius = 0
}.startAnimation()
}.startAnimation()
}
}

Expand Down

0 comments on commit 87fa253

Please sign in to comment.