Skip to content

Commit

Permalink
Made current page public
Browse files Browse the repository at this point in the history
  • Loading branch information
twof committed Dec 19, 2018
1 parent 1745220 commit 2133c52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class ViewController: UIViewController {
let dotImages = [-1: #imageLiteral(resourceName: "add")]

let pagedView = SimplePagedView(
indicatorColor: .cyan,
// indicatorColor: .cyan,
initialPage: 1,
dotSize: 10,
dotSize: 20,
imageIndices: dotImages,
with: green, red, orange
)
Expand Down
6 changes: 5 additions & 1 deletion SimplePagedViewFramework/Source/SimplePagedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public class SimplePagedView: UIViewController {
fileprivate var didInit = false
fileprivate let dotSize: CGFloat

public var currentPage: Int {
return pageControl.currentDot
}

/// Can be defined in order to trigger an action when pages are switched. Pages are 0 indexed.
public var didSwitchPages: ((Int) -> Void)?
/// Can be set to allow or disallow user interaction with the page dot indicators. Defaults to false.
Expand All @@ -58,7 +62,7 @@ public class SimplePagedView: UIViewController {
scrollView.alwaysBounceHorizontal = false
return scrollView
}()
public var pageControl: PageDotsView = {
fileprivate var pageControl: PageDotsView = {
var pageControl = PageDotsView(count: 0, frame: .zero)
pageControl.translatesAutoresizingMaskIntoConstraints = false
return pageControl
Expand Down
3 changes: 2 additions & 1 deletion SimplePagedViewFramework/Source/Views/PageDotsView.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import UIKit

public class PageDotsView: UIView {
let currentDot: Int

private var dots: [UIView] = []
private var dotCount: Int
private let currentDot: Int
private let dotSize: CGFloat
private let dotColor: UIColor
private let currentDotColor: UIColor
Expand Down

0 comments on commit 2133c52

Please sign in to comment.