https://github.com/badoo/thepagecontrol
https://github.com/badoo/thepagecontrol
ios pagecontrol swift ui-components uikit
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/badoo/thepagecontrol
- Owner: badoo
- License: mit
- Created: 2017-03-03T15:25:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T14:48:56.000Z (over 5 years ago)
- Last Synced: 2024-10-31T16:02:19.601Z (over 1 year ago)
- Topics: ios, pagecontrol, swift, ui-components, uikit
- Language: Swift
- Homepage:
- Size: 480 KB
- Stars: 21
- Watchers: 28
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# THEPageControl
*THEPageControl* is a nice page control written in Swift.
## Features
- Full control over each dot.
- Horizontal & vertical layouts with optional paddings. Works well with Auto Layout.
- Interactive non-discrete active index change so you can do nice transitions.
## How to use
```swift
let pageControl = PageControl()
pageControl.dots = Array(repeating: .default, count: 10)
pageControl.configuration.spacing = 10
// If you want to customize dots you usually create a new dot style:
extension PageControl.Dot {
static var customStyle: PageControl.Dot {
return PageControl.Dot(
regularStyle: .init(
radius: 10,
fillColor: .red,
strokeColor: .black,
strokeWidth: 10
),
activeStyle: .init(
radius: 10,
fillColor: .red,
strokeColor: .black,
strokeWidth: 5
)
)
}
}
// And then you can use the new style to fill `dots` array:
let pageControl = PageControl()
pageControl.dots = [ .default, .customStyle, .default ]
```
## How to install
### Manually
THEPageControl is a single-file component - just copy it into your project!
### CocoaPods
1. Make sure `use_frameworks!` is added to your `Podfile`.
2. Include the following in your `Podfile`:
```
pod 'THEPageControl', '= 1.0.0'
```
If you like living on the bleeding edge, you can use the `master` branch with:
```
pod 'THEPageControl', :git => 'https://github.com/badoo/THEPageControl', :branch => 'master'
```
3. Run `pod install`
## License
Source code is distributed under MIT license.