Stretchy Page Indicator

Stretchy Page Indicator

An onboarding pager with a liquid page indicator that stretches toward the next dot as you swipe, parallax hero art, and a Continue button that morphs into Get started on the last page.

Luiz Mello
  • navigation
  • progress
  • gesture

snippet.swift313 lines

5 files • Scroll to see all →
/// A liquid page indicator driven by a *continuous* progress (e.g. 1.37 means/// 37% of the way from page 1 to page 2).////// Dots grow into a capsule as their page approaches, and a gradient "ink"/// stretches toward the next dot: its head leads during the first half of/// the swipe and its tail catches up during the second — like a droplet.public struct StretchyPageIndicator: View {    let count: Int    let progress: CGFloat    var gradient: [Color]    var dotSize: CGFloat    var activeLength: CGFloat    var spacing: CGFloat​    public init(        count: Int,        progress: CGFloat,        gradient: [Color] = [.indigo, .purple],        dotSize: CGFloat = 8,        activeLength: CGFloat = 26,​// ... (click "Show full code" to see more)
Viewing: StretchyPageIndicator.swift•1 of 5