Coder Social home page Coder Social logo

augmify / reverseextension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marty-suzuki/reverseextension

0.0 1.0 0.0 12.28 MB

A UITableView extension that enables cell insertion from the bottom of a table view.

License: MIT License

Ruby 3.68% Objective-C 9.33% Swift 70.71% Shell 16.28%

reverseextension's Introduction

ReverseExtension

Version Language License Platform Carthage compatible

A UITableView extension that enables cell insertion from the bottom of a table view.

Concept

It is difficult to fill a tableview content from the bottom.

ReverseExtension rotates the UITableView and the UITableViewCells like in these images.

If you implement this logic in UIViewController, it will add too much complexity.

By encapsulating the implementation to the re namespace property, we hide the complexity.

In addition, you can roll back to the normal behavior by removing the re namespace.

Example

import UIKit
import ReverseExtension

class ViewController: UIViewController {
    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.dataSource = self
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")

        //You can apply reverse effect just by setting the delegate.
        tableView.re.delegate = self
        tableView.re.scrollViewDidReachTop = { scrollView in
            print("scrollViewDidReachTop")
        }
        tableView.re.scrollViewDidReachBottom = { scrollView in
            print("scrollViewDidReachBottom")
        }
    }
}

extension ViewController: UITableViewDelegate {
    //ReverseExtension also supports handling UITableViewDelegate.
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        print("scrollView.contentOffset.y =", scrollView.contentOffset.y)
    }
}

Requirements

  • Swift 3.0
  • Xcode 8.0 or greater
  • iOS 8.0 or greater

Installation

CocoaPods

ReverseExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ReverseExtension"

Carthage

If you’re using Carthage, simply add ReverseExtension to your Cartfile:

github "marty-suzuki/ReverseExtension"

Make sure to add ReverseExtension.framework to "Linked Frameworks and Libraries" and "copy-frameworks" Build Phases.

Special Thanks

TouchVisualizer (Created by @morizotter)

Author

marty-suzuki, [email protected]

License

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

reverseextension's People

Contributors

ca-atmosphere avatar getaaron avatar marty-suzuki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.