Skip to content

Repository files navigation

SUIPageControls

SwiftUI package with 30 custom page controls behind one compact API:

import SUIPageControls
import SwiftUI

struct Example: View {
    @State private var page = 0

    var body: some View {
        PageControl(
            currentPage: $page,
            pageCount: 5,
            style: .worm
        )
    }
}

The package is SwiftUI-native, has no external dependencies, and keeps the same core model as UIPageControl: a current page binding plus a total page count. Each indicator is tappable when allowsInteraction is enabled, and the root control supports VoiceOver adjustable actions.

Installation

In Xcode, choose File > Add Package Dependencies... and enter:

https://github.com/Georgy-hook/SUIPageControls.git

Or add it from another package:

.package(url: "https://github.com/Georgy-hook/SUIPageControls.git", branch: "main")

Supported platforms: iOS 17+, macOS 14+, tvOS 17+, watchOS 10+. iOS 26 Liquid Glass APIs are used where available by .glassCapsules and .background = .glass; older supported OS versions fall back to material styling.

Unified API

PageControl(
    currentPage: $page,
    pageCount: pages.count,
    style: .expandingCapsule,
    configuration: PageControlConfiguration(
        indicatorSize: 10,
        spacing: 9,
        activeColor: .blue,
        inactiveColor: .gray.opacity(0.3),
        secondaryActiveColor: .cyan,
        trackColor: .gray.opacity(0.15),
        lineWidth: 2,
        maxVisibleIndicators: 7,
        orientation: .horizontal,
        hidesForSinglePage: true,
        allowsInteraction: true,
        background: .none
    )
)

Useful shortcuts:

PageControl(currentPage: $page, pageCount: 8, style: .glassCapsules, configuration: .glass)
PageControl(currentPage: $page, pageCount: 20, style: .slidingWindow)
PageControl(currentPage: $page, pageCount: 6, style: .fractionLabel)

Snapshots

Generate the full visual set with:

make snapshots

The command renders every PageControlStyle into Screenshots and verifies that exactly 30 PNG files were created. On macOS 26+, it captures glassCapsules from a live window so the gallery contains the real Liquid Glass effect; macOS may request Screen Recording permission.

Styles

Style Look
classicDots Compact UIPageControl-like row of small circles with a filled current page.
scaledDots The current circle grows while inactive dots stay smaller.
fadingDots Dots fade by distance from the current page.
slidingWindow A limited moving dot window for larger page counts.
instagramDots Centered active dot with edge dots shrinking and fading near the window boundary.
expandingCapsule Active page stretches into a pill while inactive pages remain dots.
worm A rounded worm slides over the rail and stretches toward the next position.
thinWorm Slim underline-like worm for dense interfaces.
snake Longer active pill crawls over a quiet dotted track.
filledPill Every page is a small pill; the current pill fills and widens.
jumpingDots The selected dot hops upward.
droppingDots The selected dot drops with a soft shadow.
swapDots The current tile flips while inactive tiles stay flat.
exchangeDots Neighboring dots subtly trade vertical positions around the active page.
colorBlend Each page has a rotating accent color; the active color is emphasized.
chameleon Hollow inactive marks become solid active dots with a stronger accent.
hollowRings Ring indicators with a filled center only for the current page.
ringPulse Current page has an outer pulse ring.
orbit A small satellite marker orbits the active page dot.
diamonds Rotated square indicators for a sharper look.
roundedSquares Soft square indicators with a larger active tile.
lineBars Short bars where the selected page becomes taller.
equalizer Bar heights fall off by distance from the current page.
segmentedProgress Discrete progress capsules with completed/current states.
continuousProgress A single progress track filled by current page.
steppedProgress Numbered steps connected by a subtle progress rail.
underline Visible page numbers with a compact underline under the current page.
fractionLabel Text fraction paired with a mini progress bar.
numberedDots Active dot reveals the current page number.
glassCapsules Capsule indicators tuned for iOS 26 Liquid Glass with material fallback.

References

Implementation is original SwiftUI code. Ideas and behavior were reviewed from:

Snapshot Gallery

Classic Dots Scaled Dots Fading Dots Sliding Window Instagram Dots
Expanding Capsule Worm Thin Worm Snake Filled Pill
Jumping Dots Dropping Dots Swap Dots Exchange Dots Color Blend
Chameleon Hollow Rings Ring Pulse Orbit Diamonds
Rounded Squares Line Bars Equalizer Segmented Progress Continuous Progress
Stepped Progress Underline Fraction Label Numbered Dots Glass Capsules

Author and license

Created by Georgy GLuhov. Distributed under the MIT License.

About

A SwiftUI package with 30 customizable and accessible page controls.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages