TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Konstantinos Dimitros.
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).
BezierRefreshControl.swift
in your project.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.
Color:
self.refreshControl.color = UIColor.red
Stroke line width:
self.refreshControl.lineWidth = 3.0
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:
bindsScrollViewDelegate
argument to false
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)
}
I would love your contribution to BezierRefreshControl, check the LICENSE
file for more info.
Konstantinos Dimitros | twitter | email | github | linkedin
Distributed under the MIT license. See LICENSE
for more information.