SegmentedProgressBar
  • August 12, 2023

A simple little control that animates segments like Snapchat or Instagram Stories.

Screenshot

Requirements


  • iOS 8.0+
  • Xcode 8

Installation


Drag and drop SegmentedProgressBar.swift into your project. That’s it.

Usage


let spb = SegmentedProgressBar(numberOfSegments: 3, duration: 5)
spb.frame = CGRect(x: 15, y: 15, width: view.frame.width – 30, height: 4)
view.addSubview(spb)

spb.startAnimation()

Additional Stuff


Delegate:

spb.delegate = self // has to conform to SegmentedProgressBarDelegate

func segmentedProgressBarChangedIndex(index: Int) {
}

func segmentedProgressBarFinished() {
}

Styling:

spb.topColor = UIColor.white
spb.bottomColor = UIColor.white.withAlphaComponent(0.25)
spb.padding = 2

Pausing / Resuming

spb.isPaused = true
spb.isPaused = false

Skip / Rewind

spb.skip()
spb.rewind()

GitHub


View Github

#cocoa #instagram #ios #swift #swift3
YOU MIGHT ALSO LIKE...
ViewCondition

✨ Super sweet syntactic sugar for SwiftUI.View initializers. At a Glance

SwiftUIX

SwiftUIX attempts to fill the gaps of SwiftUI, providing an extensive suite of components, extensions and utilities to complement the ...

SwiftUI Environment Overrides

A tiny library that adds a control panel for testing how SwiftUI app adapts for different color themes, accessibility settings, ...