CHIPageControl Documentation

repository·master·Indexed 25 days ago

https://github.com/chililabs/chipagecontrol

A collection of animated page control components for iOS designed to replace the standard UIPageControl. Includes multiple styles such as CHIPageControlAji, CHIPageControlAleppo, and CHIPageControlPuya, with support for installation via CocoaPods, Carthage, Swift Package Manager, and manual integration.

Tokens
1K
Snippets
4
Records
7
Agent score
36%

What's inside CHIPageControl

  1. Install CHIPageControl

    master

    CHIPageControl can be installed using several methods depending on your project setup:

    CocoaPods

    Add the main pod or specific individual page controls to your Podfile:

    Carthage

    Add the following to your Cartfile:

    Swift Package Manager

    Add the dependency to your Package.swift and build your project using swift build.

    Manual Installation

    Add the CHIPageControl folder directly to your project.

    # CocoaPods
    pod 'CHIPageControl', '~> 0.1.3'
    
    # individual page control
    pod 'CHIPageControl/Aji'
    pod 'CHIPageControl/Aleppo'
    pod 'CHIPageControl/Chimayo'
    pod 'CHIPageControl/Fresno'
    pod 'CHIPageControl/Jalapeno'
    pod 'CHIPageControl/Jaloro'
    pod 'CHIPageControl/Paprika'
    pod 'CHIPageControl/Puya'
    # Carthage
    github "ChiliLabs/CHIPageControl" ~> 0.1.3
    // Swift Package Manager
    dependencies: [
        .package(url: "https://github.com/ChiliLabs/CHIPageControl.git", .branch("master"))
    ]
    $ swift build
  2. Configure CHIPageControl via Code

    master

    Initialize a page control and configure its appearance using properties like numberOfPages, radius, tintColor, currentPageTintColor, and padding.

    let pageControl = CHIPageControlAji(frame: CGRect(x: 0, y:0, width: 100, height: 20))
    pageControl.numberOfPages = 4
    pageControl.radius = 4
    pageControl.tintColor = .red
    pageControl.currentPageTintColor = .green
    pageControl.padding = 6
  3. Manage tintColors in CHIPageControl

    master

    You can set an array of colors for the indicators or insert a specific color at a given position.

    Warning: When using tintColors, the array size must exactly match numberOfPages to avoid a fatal error.

    // The size of the array needs to match the numberOfPages or it will throw an fatal error
    pageControl.tintColors = [UIColor.black, UIColor.yellow, UIColor.black, UIColor.black]
    
    // or
    
    // If it is the first one, it will fill all colors with the selected tintColor and then replace the colors with the desired one
    pageControl.insertTintColor(UIColor.yellow, position: 1)
  4. Available CHIPageControl styles

    master

    The library provides several distinct animated page control styles:

    • CHIPageControlAji
    • CHIPageControlAleppo
    • CHIPageControlChimayo
    • CHIPageControlFresno
    • CHIPageControlJalapeno
    • CHIPageControlJaloro
    • CHIPageControlPaprika
    • CHIPageControlPuya