Skip to content

Commit

Permalink
Merge pull request #16 from DeluxeAlonso/development
Browse files Browse the repository at this point in the history
Development to master for 1.4.2 version
  • Loading branch information
DeluxeAlonso authored Jul 15, 2021
2 parents 8e77664 + 174190c commit 0abb8c0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DLAutoSlidePageViewController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'DLAutoSlidePageViewController'
s.version = '1.3.2'
s.version = '1.4.2'
s.summary = 'An auto slide PageViewController.'

s.description = <<-DESC
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let pageViewController = DLAutoSlidePageViewController(pages: pages, configurati
| currentPageIndicatorTintColor | UIColor | The tint color to be used for the current page indicator. |
| pageIndicatorTintColor | UIColor | The tint color to be used for the page indicator. |
| pageControlBackgroundColor | UIColor | The background color to be used for the page control. |
| shouldAnimateTransition | Bool | Indicates whether the automatic transition is to be animated. |

## Author

Expand Down
7 changes: 6 additions & 1 deletion Sources/AutoSlideConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public protocol AutoSlideConfiguration {
/// Locations for the spine. Only valid if the transition style is UIPageViewController.TransitionStyle.pageCurl.
var spineLocation: UIPageViewController.SpineLocation { get }

/// Decides if page contron is going to be shown or not.
/// Decides if page control is going to be shown or not.
var hidePageControl: Bool { get }

/// The tint color to be used for the current page indicator.
Expand All @@ -39,6 +39,9 @@ public protocol AutoSlideConfiguration {
/// The background color to be used for the page control.
var pageControlBackgroundColor: UIColor { get }

/// Indicates whether the automatic transition is to be animated.
var shouldAnimateTransition: Bool { get }

}

// MARK: - Default values
Expand All @@ -57,4 +60,6 @@ public extension AutoSlideConfiguration {
var pageIndicatorTintColor: UIColor { UIColor.lightGray }
var pageControlBackgroundColor: UIColor { UIColor.clear }

var shouldAnimateTransition: Bool { true }

}
4 changes: 3 additions & 1 deletion Sources/DLAutoSlidePageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ open class DLAutoSlidePageViewController: UIPageViewController {
private var timeInterval: TimeInterval = 0.0
private var shouldHidePageControl: Bool = false
private var navigationDirection: UIPageViewController.NavigationDirection = .forward
private var shouldAnimateTransition: Bool = false

private var transitionInProgress: Bool = false

Expand Down Expand Up @@ -52,6 +53,7 @@ open class DLAutoSlidePageViewController: UIPageViewController {
self.timeInterval = configuration.timeInterval
self.shouldHidePageControl = configuration.hidePageControl
self.navigationDirection = configuration.navigationDirection
self.shouldAnimateTransition = configuration.shouldAnimateTransition

setupPageView()
setupPageTimer(with: timeInterval)
Expand Down Expand Up @@ -150,7 +152,7 @@ open class DLAutoSlidePageViewController: UIPageViewController {
guard let viewController = viewControllerAtIndex(currentPageIndex) as UIViewController? else { return }
if !transitionInProgress {
transitionInProgress = true
setViewControllers([viewController], direction: navigationDirection, animated: true, completion: { finished in
setViewControllers([viewController], direction: navigationDirection, animated: shouldAnimateTransition, completion: { finished in
self.transitionInProgress = false
})
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/DefaultAutoSlideConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ final public class DefaultAutoSlideConfiguration: AutoSlideConfiguration {
public var pageIndicatorTintColor: UIColor = UIColor.lightGray
public var pageControlBackgroundColor: UIColor = UIColor.clear

public var shouldAnimateTransition: Bool = true

}

0 comments on commit 0abb8c0

Please sign in to comment.