Skip to content

Instantly share code, notes, and snippets.

@samwarnick
Created April 19, 2017 16:37
Show Gist options
  • Save samwarnick/4cd98e13bd182de3361508e7146bc315 to your computer and use it in GitHub Desktop.
Save samwarnick/4cd98e13bd182de3361508e7146bc315 to your computer and use it in GitHub Desktop.
A few lines of code that are necessary to show the page indicator dots
/*
These functions are neccessary for the page indicator dots to show up.
They are optional functions of UIPageViewControllerDataSource, so they do not come up as overrides.
*/
func presentationCount(for pageViewController: UIPageViewController) -> Int {
return orderedViewControllers.count
}
func presentationIndex(for pageViewController: UIPageViewController) -> Int {
return 0
}
// In viewDidLoad, this will let you style the dots a bit
let pageControlAppearance = UIPageControl.appearance(whenContainedInInstancesOf: [PageViewController.self])
pageControlAppearance.currentPageIndicatorTintColor = UIColor.stnRichElectricBlue
pageControlAppearance.pageIndicatorTintColor = UIColor.stnColumbiaBlue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment