From 15d60bd3ebecd9641a33e0abe97fa5d8debebdee Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Mon, 20 Dec 2021 14:45:14 -0500 Subject: [PATCH] remove self. --- .../SubNav/SubNavInteractor.swift.swift | 38 +++++++++---------- .../Managers/SubNav/SubNavSwipeAnimator.swift | 14 +++---- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/MVMCoreUI/Managers/SubNav/SubNavInteractor.swift.swift b/MVMCoreUI/Managers/SubNav/SubNavInteractor.swift.swift index 39a71bf3..233a1f57 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavInteractor.swift.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavInteractor.swift.swift @@ -45,11 +45,11 @@ fileprivate enum SubNavPanningDirection : Int { } public init(viewController: UIViewController, delegate: SubNavSwipeNavigationProtocol) { - self.pannablePercentage = 0.15 + pannablePercentage = 0.15 self.delegate = delegate super.init() - self.panGesture = UIPanGestureRecognizer.init(target: self, action: #selector(handlePanGesture)); - viewController.view.addGestureRecognizer(self.panGesture) + panGesture = UIPanGestureRecognizer.init(target: self, action: #selector(handlePanGesture)); + viewController.view.addGestureRecognizer(panGesture) } //overrides @@ -91,20 +91,20 @@ fileprivate enum SubNavPanningDirection : Int { case .began: // Begin the transition to the next page. - self.panning = true + panning = true if velocityX < 0 && pannableFrameRight.contains(locationInView) { - self.delegate?.swipeLeft() - self.panningDirection = .left + delegate?.swipeLeft() + panningDirection = .left } else if velocityX > 0 && pannableFrameLeft.contains(locationInView){ - self.delegate?.swipeRight() - self.panningDirection = .right + delegate?.swipeRight() + panningDirection = .right } case .changed: - guard self.interactive else { return } + guard interactive else { return } - if self.panningDirection == .right && translation.x < 0 || - self.panningDirection == .left && translation.x > 0 { + if panningDirection == .right && translation.x < 0 || + panningDirection == .left && translation.x > 0 { percentage = 0 } @@ -114,27 +114,27 @@ fileprivate enum SubNavPanningDirection : Int { if percentage > 1.00 { percentage = 1.00; } - self.shouldCompleteTransition = percentage > 0.65; - self.update(percentage) - self.delegate?.update(percentage: percentage) + shouldCompleteTransition = percentage > 0.65; + update(percentage) + delegate?.update(percentage: percentage) case .cancelled: - self.cancel() + cancel() case .ended: if ((percentage < 0) != (velocityX < 0)) && abs(velocityX) > 50 { // If we are moving back toward the previous view we want to cancel. (the speed threshold is for shaky hands) - self.cancel() + cancel() } else if abs(velocityX) > 300.0 || shouldCompleteTransition { // Need to cancel the transition if we pass the threshold, but from a opposite direction(e.g. Start panning from left edge to right, then move back, pass the start x location, end with a high velocityX) if ((panningDirection == .right) && translation.x < 0) || ((panningDirection == .left) && translation.x > 0) { - self.cancel() + cancel() } else { // If we pass the speed or screen percentage thresholds, move on to the next screen. - self.finish() + finish() } } else { - self.cancel() + cancel() } default: diff --git a/MVMCoreUI/Managers/SubNav/SubNavSwipeAnimator.swift b/MVMCoreUI/Managers/SubNav/SubNavSwipeAnimator.swift index 810dd4a5..b614cf9a 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavSwipeAnimator.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavSwipeAnimator.swift @@ -23,25 +23,25 @@ import MVMCore } public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { - self.animationTime = 0.5 - return self.animationTime + animationTime = 0.5 + return animationTime } public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { - self.controller?.view.isUserInteractionEnabled = false + controller?.view.isUserInteractionEnabled = false let containerView = transitionContext.containerView guard let originalViewController = transitionContext.viewController(forKey: .from), let destinationViewController = transitionContext.viewController(forKey: .to) else { return } var destStartFrame = containerView.bounds - destStartFrame.origin.x = self.direction == .right ? -destStartFrame.size.width : destStartFrame.size.width + destStartFrame.origin.x = direction == .right ? -destStartFrame.size.width : destStartFrame.size.width containerView.addSubview(destinationViewController.view) destinationViewController.view.frame = destStartFrame let destEndFrame = containerView.bounds var origEndFrame = containerView.bounds - origEndFrame.origin.x = self.direction == .right ? origEndFrame.size.width : -origEndFrame.size.width + origEndFrame.origin.x = direction == .right ? origEndFrame.size.width : -origEndFrame.size.width UIView.animate(withDuration: animationTime, animations: { originalViewController.view.frame = origEndFrame @@ -53,8 +53,8 @@ import MVMCore public func animationEnded(_ transitionCompleted: Bool) { if !transitionCompleted { - self.interactiveTransitionCanceled = true + interactiveTransitionCanceled = true } - self.controller?.view.isUserInteractionEnabled = true + controller?.view.isUserInteractionEnabled = true } }