iOS Simple Cool PullToRefresh Library. It is written in pure swift.

Overview

PullToRefreshSwift

Platform Language License Issues

iOS Simple PullToRefresh Library.

sample

##Installation

####CocoaPods

pod 'PullToRefreshSwift'

####Manually Add the following files to your project. pulltorefresharrow.png PullToRefreshView.swift PullToRefreshConst.swift UIScrollViewExtension.swift

##Usage

###Setup

In your UIViewController Including UITableView, UICollectionView, UIScrollView:

  override func viewDidLoad() {
        self.tableView.addPullToRefresh({ [weak self] in
            // refresh code
            
            self?.tableView.reloadData()
            self?.tableView.stopPullToRefresh()
        })
  }

You can use PullToRefreshOption class at addPullToRefresh func option parameter:

  override func viewDidLoad() {
       let options = PullToRefreshOption()
        options.backgroundColor = UIColor.blueColor()
        options.indicatorColor = UIColor.whiteColor()
        
        self.tableView.addPullToRefresh(options: options, { [weak self] in
            // some code
            
            self?.tableView.reloadData()
            self?.tableView.stopPullToRefresh()
        })
        
  }

If you want to fixed pulltoRefreshView, please implement scrollViewDidScroll.

  func scrollViewDidScroll(scrollView: UIScrollView) {
    self.tableView.fixedPullToRefreshViewForDidScroll()
  }  

If you want to use the custom const, please change the PullToRefreshConst class.

struct PullToRefreshConst {
    static let tag = 810
    static let alpha = true
    static let height: CGFloat = 80
    static let imageName: String = "pulltorefresharrow.png"
    static let animationDuration: Double = 0.4
    static let fixedTop = true // PullToRefreshView fixed Top
}

If you want to use the custom option, please change the PullToRefreshOption class. You can use this class at addPullToRefresh func option parameter.

class PullToRefreshOption {
    var backgroundColor = UIColor.clearColor()
    var indicatorColor = UIColor.grayColor()
    var autoStopTime: Double = 0.7 // 0 is not auto stop
    var fixedSectionHeader = false  // Update the content inset for fixed section headers
}

Requirements

Requires Swift3.0 and iOS 8.0 and ARC.
If you are developing in the Swift1.1 ~ 2.3, please use branch of Swift1.1 ~ Swift2.3.

Features

  • Highly customizable
  • Complete example
  • Refactoring

Contributing

Forks, patches and other feedback are welcome.

Creator

Yuji Hato Blog

License

PullToRefreshSwift is available under the MIT license. See the LICENSE file for more info.

Comments
  • Add push up function

    Add push up function

    Hi I added a push up to refresh function in addition to your pull down refresh. Also refactor your codes a little bit. If you are interested I will send you a pull request. Or you can just check my fork

    opened by qiulang 2
  • Remove the 'scrollViewBounces' property that is unnecessary and causes bugs from PullToRefreshView

    Remove the 'scrollViewBounces' property that is unnecessary and causes bugs from PullToRefreshView

    The 'scrollViewBounces' that is a property of the PullToRefreshView is used for saving scrollView.bounces of super view before animating. But super view of the PullToRefreshView cannot do 'PullToRefresh' if the its scrollView.bounces is false. So scrollView.bounces of super view is always true before animating.

    In addition, the 'scrollViewBounces' causes a bug that the UITableView cannot do 'PullToRefresh' in my project.

    So I remove the 'scrollViewBounces' from the PullToRefreshView. Please check my modifications.

    opened by kitoko552 1
  • Add a public initializer to PullToRefreshOption

    Add a public initializer to PullToRefreshOption

    PullToRefreshOption initializer is inaccessible from external projects on latest version 3.0.1 because its protection level is 'internal'. So I fixed it by adding a 'public' initializer to PullToRefreshOption.

    opened by kitoko552 1
  • swift2.0対応

    swift2.0対応

    突然のご連絡ですみません こちらすごいいいなと思い使わせてもらおうと思っています。 そこで、swift2.0に対応した修正をさせていただきました

    https://github.com/shiratsu/PullToRefreshSwift/commit/be400a538d8b825276d3af449a5e2b4e37387b5f#diff-39a3da6a4de7b8ddafc91f4ecb40ffd0 https://github.com/shiratsu/PullToRefreshSwift/commit/3e8634a80d9dc357b86ea55d2b9aa9a4ebbdfabf https://github.com/shiratsu/PullToRefreshSwift/commit/46680ee597bf47436363f152ce81bc60a6c5feb0#diff-9c035c3db6d57f68e7eb18282efdd973

    こちらをマージしたいなって思ったのですが、swift1.2のソースを壊すのもどうかなって思い、ちょっと迷って、一旦issueを上げて質問させていただきました

    よろしくお願いいたします

    opened by shiratsu 1
  • Change the timing of storing scroll view properties

    Change the timing of storing scroll view properties

    Using PullToRefreshSwift with UITableViewController, the navigation bar appear over the table view after refresh. UITableViewController seems has not set up table view's properties at viewDidLoad.

    opened by Ridwy 1
  • Support for Swift 2.0 and embedded framework

    Support for Swift 2.0 and embedded framework

    I would appreciate you would review this pull request. The main changes are as bellow.

    • Convert the files in this repository to Swift 2.0
    • Change the access control of some files to support embedded framework
    • Fix the bug that an image resource cannot be loaded when built as embedded framework
    opened by tasanobu 0
  • Runtime Issues

    Runtime Issues

    I don't know if this is related or the same as #34, but instead of getting a crash, I am getting a runtime issue saying that

    Simultaneous accesses to 0x7f9c20c35e30, but modification requires exclusive access

    on this line:

    // PullToRefreshView.swift line 153
    if !(context == &kvoContext && keyPath == contentOffsetKeyPath) {
    
    opened by Sweeper777 0
  • Missing argument for parameter #1 in call

    Missing argument for parameter #1 in call

    The following line of code in PullToRefreshConst.swift file is causing compile time error when Swift 4.1 is being used as per Build Settings:

    self.refreshCompletion?()

    Missing argument for parameter #1 in call

    Insert '<#Void#>'

    opened by speedoholic 1
  • Simultaneous access in observeValue(forKeypath:of:change:context:) causes a crash

    Simultaneous access in observeValue(forKeypath:of:change:context:) causes a crash

    When building with Xcode 9.1/Swift 4, our production app crashes on load with the following message:

    Thread 1: Simultaneous accesses to 0x10391fbb0, but modification requires exclusive access

    Initial call where the issue happens is

    tableView.addPullRefresh(options:refreshCompletion), which then cascades down to the method mentioned above.

    Possibly caused by something similar to this: https://github.com/Yalantis/PullToRefresh/issues/72

    opened by aurora14 0
Owner
Yuji Hato
Software Engineer Server, web, Android, iOS https://twitter.com/dekatotoro
Yuji Hato
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
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
Simple way to add parallax header to UIScrollView/UITableView written in Swift.

ParallaxHeader Simple way to add parallax header to UIScrollView or it's subclasses. One image view Slider with images Blur vibrant text Blur round ic

Roman Sorochak 998 Dec 11, 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
Simple refresh control for iOS based on SpriteKit and Core Graphics

RainyRefreshControl Simple refresh control for iOS based on SpriteKit and Core Graphics. Project inspired by concept of Yup Nguyen Installation Instal

Onix-Systems 680 Dec 29, 2022
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
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
✳️ 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
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
API-TableView-Swift - API call with URLSession and show data to TableView with swift

API-TableView-Swift API call with URLSession and show data to TableView with swi

Aman Ullah Akhand 1 Sep 3, 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
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
Recipe App TableView Using Swift

RecipeApp---TableView Features in Food Recipe App User Login search for recipes View recipe lists View Steps tutorials for recipes Like recipes In app

Hardik 3 Apr 27, 2022
Add PullToRefresh using animated GIF to any scrollView with just simple code

UzysAnimatedGifPullToRefresh Add PullToRefresh using animated GIF to any scrollView with just simple code UzysAnimatedGifPullToRefresh features: simpl

Jaehoon Jung 1.4k Nov 20, 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
FloatingActionSheetController is a cool design ActionSheetController library written in Swift2.

FloationgActionSheetController FloatingActionSheetController is a cool design ActionSheetController library written in Swift2. Overview Requirements X

Ryo Aoyama 141 Oct 30, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Aufree 465 Nov 28, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Aufree 465 Nov 28, 2022
Better payment user experience library with cool animation in Swift

?? Preview ?? Features Easily usable Simple Swift syntax Cool flip animation Compatible with Carthage Compatible with CocoaPods Customizable Universal

yassir RAMDANI 177 Nov 20, 2022
Pure makes Pure DI easy in Swift.

Pure Pure makes Pure DI easy in Swift. This repository also introduces a way to do Pure DI in a Swift application. Table of Contents Background Pure D

Suyeol Jeon 363 Dec 26, 2022