From e114f06aacfea199a9dd5a6818767c414fe1c971 Mon Sep 17 00:00:00 2001 From: Pavel Kondrashkov Date: Tue, 13 Feb 2018 18:57:46 +0300 Subject: [PATCH] isScrollEnabled exposed to public api as intended fixed wrong current index calculation for not layouted views --- Source/SlideController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/SlideController.swift b/Source/SlideController.swift index 856db7c..474423f 100644 --- a/Source/SlideController.swift +++ b/Source/SlideController.swift @@ -223,7 +223,7 @@ public class SlideController: NSObject, UIScrollViewDelegate, ControllerSl contentSlidableController.slideContentView.changeLayoutAction = changeContentLayoutAction } - var isScrollEnabled: Bool = true { + public var isScrollEnabled: Bool = true { didSet { contentSlidableController.slideContentView.isScrollEnabled = isScrollEnabled } @@ -329,7 +329,9 @@ public class SlideController: NSObject, UIScrollViewDelegate, ControllerSl if index < currentIndex { shift(pageIndex: currentIndex - 1, animated: false) - currentIndex = currentIndex - 1 + if contentSlidableController.slideContentView.isLayouted { + currentIndex = currentIndex - 1 + } } else if index == currentIndex { /// TODO: check this case if currentIndex < content.count {