Custom animated pull-to-refresh that can be easily added to UIScrollView

Overview

PullToMakeSoup Carthage compatible

Custom animated pull-to-refresh that can be easily added to UIScrollView

Yalantis

Check this article on our blog to know more details about animations implementation

Inspired by this project on dribble

Requirements

  • iOS 8.0+
  • Xcode 8
  • Swift 3
  • Portrait orientation

Carthage

github "Yalantis/PullToMakeSoup" ~> 2.0

Installing with CocoaPods

use_frameworks!
pod 'PullToMakeSoup', '~> 2.0'

Usage

At first, import PullToMakeSoup framework:

import PullToMakeSoup

Create refresher:

let refresher = PullToMakeSoup()

Add refresher to your UIScrollView subclass in 'viewDidAppear' method and provide action block:

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    tableView.addPullToRefresh(refresher) {
        // action to be performed (pull data from some source)
    }
}

After the action is completed and you want to hide the refresher:

tableView.endRefreshing()

You can also start refreshing programmatically:

tableView.startRefreshing()

Component was implemented based on customizable pull-to-refresh

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

The MIT License (MIT)

Copyright © 2017 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comments
  • Animation slides up and hides after releasing the pull handle

    Animation slides up and hides after releasing the pull handle

    I have implemented the code as suggested. Everything works fine except that when I release the pull, the tableview cells and animation both slides up and animation hides behind the navigation bar. How can I keep the animation on screen until it is completed and then slide it up to disappear from the screen?

    opened by nimblemindsapps 6
  • swift 2.0 Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions

    swift 2.0 Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions

    Pulltomakesoup.swift file and location has this error:

    let progressWithOffset: (Double, Double) -> Double = { offset, progress in return progress < offset ? 0 : Double((progress - offset) * 1 / (1 - offset))

    opened by alexliubj 4
  • image not found !!!

    image not found !!!

    2016-06-16 17:04:24.126 SouWang[99009:1017324] Could not load the "circle" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.127 SouWang[99009:1017324] Could not load the "shadow" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.128 SouWang[99009:1017324] Could not load the "cover" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.128 SouWang[99009:1017324] Could not load the "pan" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.129 SouWang[99009:1017324] Could not load the "carrot" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.129 SouWang[99009:1017324] Could not load the "potato" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.130 SouWang[99009:1017324] Could not load the "water" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.130 SouWang[99009:1017324] Could not load the "pea" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup" 2016-06-16 17:04:24.131 SouWang[99009:1017324] Could not load the "Flames0001" image referenced from a nib in the bundle with identifier "org.cocoapods.PullToMakeSoup"

    opened by ghost 3
  • Can't find Soupview

    Can't find Soupview

    public class PullToMakeSoup: PullToRefresh { public convenience init() {

        let refreshView =  NSBundle(identifier: "Yalantis.PullToMakeSoup")!.loadNibNamed("SoupView", owner: nil, options: nil).first as! SoupView
        let animator =  SoupAnimator(refreshView: refreshView)
        self.init(refreshView: refreshView, animator: animator)
    }
    

    }

    fatal error: unexpectedly found nil while unwrapping an Optional value

    opened by alexliubj 3
  • Ambiguous use of 'init'

    Ambiguous use of 'init'

    let refresher = PullToMakeSoup() When I add this somewhere in my code, I get that error. Yes I included the import PullToMakeSoup and PullToRefresh. Also, tableView.endRefreshing() is saying: Missing argument for ' at'. How can I fix this?

    status: need feedback 
    opened by Jasperav 2
  • warning: Could not find remote branch 1.4.0 to clone. fatal: Remote branch 1.4.0 not found in upstream origin

    warning: Could not find remote branch 1.4.0 to clone. fatal: Remote branch 1.4.0 not found in upstream origin

    Zafars-iMac:podinstall ZafarAhmad$ pod install Analyzing dependencies Downloading dependencies Installing PullToMakeFlight (1.1.2) Installing PullToMakeSoup (1.2) Installing PullToRefresher (1.4.0)

    [!] Error installing PullToRefresher [!] /usr/bin/git clone https://github.com/Yalantis/PullToRefresh.git /var/folders/89/9pzfjxd50bs5_hy39qqm3m8r0000gn/T/d20160804-2979-vq368o --template= --single-branch --depth 1 --branch 1.4.0

    Cloning into '/var/folders/89/9pzfjxd50bs5_hy39qqm3m8r0000gn/T/d20160804-2979-vq368o'... warning: Could not find remote branch 1.4.0 to clone. fatal: Remote branch 1.4.0 not found in upstream origin

    This is my Podfile

    Uncomment this line to define a global platform for your project

    platform :ios, '8.0'

    inhibit_all_warnings!

    target 'podinstall' do

    Comment this line if you're not using Swift and don't want to use dynamic frameworks

    use_frameworks!

    Pods for podinstall

    target 'podinstallTests' do pod 'PullToMakeFlight' pod 'PullToMakeSoup'

    # Pods for testing
    

    end

    target 'podinstallUITests' do inherit! :search_paths # Pods for testing end

    end

    type: bug 
    opened by zafar007 1
  • Cocoapod update problems.

    Cocoapod update problems.

    Currently trying to upgrade from v1.0 to v1.1. When I try do a build, I get the following error: Could not build module 'PullToMakeSoup'. I am trying to import into an Objective-C controller. When I inspect the selectors, it does reveal the appropriate -Swift.h file, but the build continues to fail. I am using use_frameworks! in my .Podfile.

    Any ideas or suggestions? I have tried to clean, rebuild, and clear out Derived Data to no avail.

    opened by laud 1
  • viewDidAppear

    viewDidAppear

    Hi, thanks for such wonderful animation.

    I think we need to mention that it only work when the size is determined. Like in viewDidAppear as in the example project

    override func viewDidAppear(animated: Bool) {
            super.viewDidAppear(animated)
    
            tableView.addPullToRefresh(PullToMakeSoup(), action: {
                let delayTime = dispatch_time(DISPATCH_TIME_NOW,
                    Int64(5 * Double(NSEC_PER_SEC)))
                dispatch_after(delayTime, dispatch_get_main_queue()) { [unowned self] in
                    self.tableView.endRefreshing()
                }
            })
        }
    
    opened by onmyway133 1
  • Simultaneous Access issue

    Simultaneous Access issue

    Report a bug

    In line 98 and 126 of PullToRefresh.swift, the following warning is generated: Simultaneous accesses to 0x104e18828, but modification requires exclusive access

    line 98: if (context == &KVOContext && keyPath == contentOffsetKeyPath && object as? UIScrollView == scrollView) {

    line 126: else if (context == &KVOContext && keyPath == contentSizeKeyPath && object as? UIScrollView == scrollView) {

    I believe this is an issue from Swift 4 monitoring simultaneous access more carefully.

    Your Environment

    • Version of the component: 2.0
    • Swift version: 4.1
    • Device: iphone 8
    • Xcode version: 9.4

    Stack

       CocoaPods : 1.3.1
            Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
        RubyGems : 2.5.2
            Host : Mac OS X 10.13.4 (17E199)
           Xcode : 9.4 (9F1027a)
             Git : git version 2.15.1 (Apple Git-101)
    Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
    Repositories : master - https://github.com/CocoaPods/Specs.git @ d216389487cda4da0b37deddcb79b5f6373ede58
    

    Installation Source

    Executable Path: /usr/local/bin/pod
    

    Plugins

    cocoapods-deintegrate : 1.0.2
    cocoapods-plugins     : 1.0.0
    cocoapods-search      : 1.0.0
    cocoapods-stats       : 1.0.0
    cocoapods-trunk       : 1.3.0
    cocoapods-try         : 1.1.0
    

    Podfile

    # Uncomment this line to define a global platform for your project
    # platform :ios, '9.0'
    
    target '' do
    
      pod 'PullToMakeSoup', '~> 2.0'
    end
    
    opened by AdamMoffitt 3
Releases(2.0)
Owner
Yalantis
Knowledge is power and the way to get power is by sharing knowledge. We are open source because this is a smart way to live, work and play.
Yalantis
Animated "Pull To Refresh" Library for UIScrollView.

PullToBounce Animated "Pull To Refresh" Library for UIScrollView. You can add animated "pull to refresh" action to your UIScrollView, UITableView and

Takuya Okamoto 1.9k Dec 5, 2022
Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.

SVPullToRefresh + SVInfiniteScrolling These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities

Sam Vermette 4.9k Dec 1, 2022
LCPullRefresh - Use UIActivityIndicatorView to provide a pull-to-refresh function for UIScrollView.

LCPullRefresh Use UIActivityIndicatorView to provide a pull-to-refresh function for UIScrollView. Requirements iOS 8.0+ Xcode 11.0+ Usage Pull-up refr

LiuChang 7 Aug 5, 2022
Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development.

KafkaRefresh Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development. Report bug · Request feature · 中文文档

H. H. Hsiang 1.2k Dec 11, 2022
Pull to refresh functionality for any ScrollView in SwiftUI!

SwiftUIPullToRefresh Pull to refresh is a common UI pattern, supported in UIKit via UIRefreshControl. (Un)surprisingly, it's also unavailable in Swift

Gordan Glavaš 185 Dec 29, 2022
Elastic pull to refresh for iOS developed in Swift

DGElasticPullToRefresh Elastic pull to refresh compontent developed in Swift Inspired by this Dribbble post: Pull Down to Refresh by Hoang Nguyen Tuto

Danil Gontovnik 3.7k Jan 3, 2023
A pull-down-to-refresh control for iOS that plays pong, originally created for the MHacks III iOS app

BOZPongRefreshControl A pull-down-to-refresh control for iOS that plays pong Installation It's on CocoaPods! Put pod 'BOZPongRefreshControl' in your P

Ben Oztalay 885 Dec 12, 2022
Fully customizable pull-to-refresh control inspired by Storehouse iOS app

CBStoreHouseRefreshControl What is it? A fully customizable pull-to-refresh control for iOS inspired by Storehouse iOS app ![screenshot1] (https://s3.

Suyu Zhang 4k Jan 6, 2023
Customizable pull-to-refresh control,written in pure Swift.

What is it This project is heavily inspired by CBStoreHouseRefreshControl which is Objective-C implemented. SurfingRefreshControl provides you a chanc

Peiwei 55 Aug 21, 2022
One gesture, many actions. An evolution of Pull to Refresh.

MNTPullToReact MNTPullToReact is an extended evolution of the famous Pull to Refresh interaction. The main idea comes from a unique question: can the

Mention 777 Nov 20, 2022
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh Play BreakOut while loading - A playable pull to refresh view using SpriteKit BreakOutToRefresh uses SpriteKit to add a playable min

Dominik Hauser 2.5k Dec 29, 2022
An easy way to use pull-to-refresh.

MJRefresh An easy way to use pull-to-refresh ?? ✍??Release Notes: more details Contents New Features Dynamic i18n Switching SPM Supported Swift Chaini

M了个J 13.7k Jan 6, 2023
GIFRefreshControl is a pull to refresh that supports GIF images as track animations.

GIFRefreshControl GIFRefreshControl is a pull to refresh that supports GIF images as track animations. Installation You have multiple choices here: Co

Kevin Delannoy 163 Oct 4, 2022
Pull-to-refresh animation in UICollectionView with a sticky header flow layout, written in Swift :large_orange_diamond:

ReplaceAnimation Implementation of Zee Young's Dribbble animation (https://dribbble.com/shots/2067564-Replace) Info I really liked Zee Young's animati

Alex Türk 957 Sep 13, 2022
ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

Vincent Li 1.7k Jan 8, 2023
An easy way to use pull-to-refresh

CRRefresh an easy way to use pull-to-refresh, If you want to customize its UI style, you just need conform the specified protocol. We will not regular

CRAnimation 957 Dec 13, 2022
PullToRefreshSwiftUI - Pull to refresh for SwiftUI

PullToRefreshSwiftUI Pull to refresh for SwiftUI. Usage with @State import Swift

Dmitry Kononchuk 1 Feb 28, 2022
✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package.

Refreshable ✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package. See complementary article at SwiftUI Pull to Refresh (for iOS 13 and iOS 14).

Geri Borbás 21 Dec 2, 2022
PullToRefresh extension for all UIScrollView type classes with animated text drawing style

PullToRefreshCoreText PullToRefresh extension for all UIScrollView type classes with animated text drawing style Demo Install Manual Copy the files in

Cem Olcay 314 Dec 3, 2022