GearRefreshControl
  • September 24, 2023

A custom animation for the UIRefreshControl. Inspired by this Dribble shot and this tutorial.

Screenshot


Usage


Install through CocoaPods

pod ‘GearRefreshControl’, ‘~> 1.0.0’

use_frameworks!

Setup your refreshControl:

override func viewDidLoad() {
super.viewDidLoad()
gearRefreshControl = GearRefreshControl(frame: self.view.bounds)
gearRefreshControl.addTarget(self, action: #selector(ViewController.refresh), for: UIControlEvents.valueChanged)
self.refreshControl = gearRefreshControl
}

Update state:

override func scrollViewDidScroll(_ scrollView: UIScrollView) {
gearRefreshControl.scrollViewDidScroll(scrollView)
}

Stop the animation on completion:

self.gearRefreshControl.endRefreshing()

Customization


You can customize the color of the control by setting the gearTintColor property:

gearRefreshControl.gearTintColor = .red

Checkout the sample project for the full implementation.

GitHub


View Github

YOU MIGHT ALSO LIKE...
Popup View

Floaters Toasts Popups Sheets

Drops 💧

A µFramework for showing alerts like the one used when copying from pasteboard or connecting Apple pencil.

MarqueeText

A SwiftUI Marquee or "scrolling text" effect found in Apple native apps. For when one line isn't enough, but two ...

TextBuilder

Introduction Text composition in SwiftUI can often be cumbersome, especially when there's logic affecting its format and content. TextBuilder leverages the ...

TextView

Download File -> Swift Packages -> Add Package Dependency... Select your project Enter https://github.com/kenmueller/TextView for the package repository URL Select Branch: master Click Finish ...