BezierRefreshControl 1.0.1

BezierRefreshControl 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Konstantinos Dimitros.




Bezier Refresh Control

A vector-based (using bezier paths) animated loading control (pull-to-refresh) for iOS scroll views (to be used in table & collection views).

BezierRefreshControl implements an animated way of drawing bezier paths to be used as a loading control in iOS scroll views - like in case of refreshing the content of a table view (or collection view) - pull-to-refresh action. Developer can provide its own bezier path at the initialisation phase of the control to be animated. The animation executes while data is loading (e.g. fetching data from a remote source/API).

FlameRefreshControl

Features

  • [x] Custom bezier paths support
  • [x] Working in every UIScrollView subclass
  • [x] Color customisation
  • [x] Stroke line width customisation

Requirements

  • iOS 8.0+
  • Xcode 7.3

Installation

Manually

  1. Download and drop BezierRefreshControl.swift in your project.
  2. Congratulations!

Usage example

Do the import :

import BezierRefreshControl

Create a property in your class:

var refreshControl: BezierRefreshControl!

In your viewDidLoad() method add these:

// Init BezierRefreshControl
self.refreshControl = BezierRefreshControl(inScrollView: self.tableView, withPath: createSampleFlamePath(), bindsScrollViewDelegate: true)

// Set the delegate
self.refreshControl.delegate = self

Notice that you need to provide your UIBezierPath instance as an initialisation argument.

Properties

Color:

self.refreshControl.color = UIColor.red

Stroke line width:

self.refreshControl.lineWidth = 3.0

UIScrollViewDelegate binding

If you noticed at the initialisation phase there is a boolean argument about binding the scroll view delegate. In case you need to implement the scroll view delegate in your code you need to do these two steps:

  1. At the initialisation phase, set bindsScrollViewDelegate argument to false
  2. Inside the implemented (in your code) delegate methods of UIScrollViewDelegate, call the control’s publicly exposed methods:
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
self.refreshControl.scrollViewWillBeginDragging(scrollView)
}

func scrollViewDidScroll(_ scrollView: UIScrollView) {
self.refreshControl.scrollViewDidScroll(scrollView)
}

func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
self.refreshControl.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
}

Contribute

I would love your contribution to BezierRefreshControl, check the LICENSE file for more info.

About Me

Konstantinos Dimitros | twitter | email | github | linkedin

License

Distributed under the MIT license. See LICENSE for more information.