shima11 / FlexiblePageControl

A flexible UIPageControl like Instagram.
MIT License
797 stars 108 forks source link

Make FlexiblePageControl properties customizable via UIAppearance #40

Open bhr opened 4 years ago

bhr commented 4 years ago

The proposed changes allow FlexiblePageControl to be customizable via UIAppearance, for instance:

let config = FlexiblePageControl.Config(
    displayCount: 5,
    dotSize: 6,
    dotSpace: 4,
    smallDotSizeRatio: 0.5,
    mediumDotSizeRatio: 0.7
)
FlexiblePageControl.appearance().pageIndicatorTintColor = UIColor.systemGray
FlexiblePageControl.appearance().currentPageIndicatorTintColor = UIColor.systemBlue
FlexiblePageControl.appearance().setConfig(config)
bhr commented 4 years ago

I found an issue with the displayCount not updating properly.

The issue has been fixed in the second commit. displayCount needs to be updated when setting calling setConfig: