TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2017 |
SwiftSwift Version | 3.2 |
SPMSupports SPM | ✗ |
Maintained by Urtaq.
Show an animation as far as moved scroll while scrolling at the scroll view for Swift3
This code style is the Protocol Oriented Programming
.
So some protocols are configured to implement the parallax scrolling.
This extends the scrollView to make the parallax scrolling feature on the Run time, using objc_getAssociatedObject.
To show the animation as scrolling, Lottie is able to be used instead of UIImageView.
In addition to, you can provide the funny factor, Haptic feedback.
The haptic feedback is provided by scrolling down.(But only for iOS 10)
Add the following to your Podfile
.
pod "URParallaxScrollAnimator"
See the Example
folder.
Run pod install
and open the .xcworkspace file.
import URParallaxScrollAnimator
// for example...
func initView() {
self.tableView.parallaxScrollExtension.makeParallaxScrollExtensionConfiguration(upperImage: #imageLiteral(resourceName: "cloud_by_ur2"), lowerImage: #imageLiteral(resourceName: "mountain_by_ur2"), lowerLottieData: nil)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
...
self.tableView.parallaxScrollExtension.parallaxScrollViewDidScroll(scrollView)
...
}
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
...
self.tableView.parallaxScrollExtension.parallaxScrollViewWillBeginDragging(scrollView)
...
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
...
self.tableView.parallaxScrollExtension.parallaxScrollViewDidEndDragging(scrollView)
...
}
// for example, if calling the reload function,
// you must call the "parallaxScrollViewDidPullToRefresh" function just after reloading
func handleAPICallFinish() {
...
self.tableView.parallaxScrollExtension.parallaxScrollViewDidPullToRefresh()
...
}
URParallaxScrollAnimator is available under the MIT license. See the LICENSE file for more info.