ReverseExtension 0.4.7

ReverseExtension 0.4.7

DocsDocumented
TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Taiki Suzuki.


Downloads

Total801
Week202
Month664

Installs

Apps118
Apps WeekApps This Week 24
Pod Tries3
Test Targets5
Test WeekTests This week 2
powered by Segment

GitHub

Stars996
Watchers19
Forks34
Issues1
Contributors3
Pull Requests0

Code

Files7
SizeIntegration Size 52 kb
FrameworkCreates Framework
LOCLines of Code 490


ReverseExtension

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

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.