ReverseExtension 0.4.0

ReverseExtension 0.4.0

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

Maintained by Taiki Suzuki.


Downloads

Total71
Week50
Month71

Installs

Apps17
Apps WeekApps This Week 17
Pod Tries1
Pod Tries WeekPod Tries This Week 1
Test Targets1
Test WeekTests This week 1
powered by Segment

GitHub

Stars685
Watchers10
Forks22
Issues0
Contributors3
Pull Requests0

Code

Files6
SizeIntegration Size 48 kb
FrameworkCreates Framework
LOCLines of Code 431


ReverseExtension

UITableView extension that enabled to insert cell from bottom of tableView.

Concept

It is difficult to fill a tableview content from bottom. So, ReverseExtension rotate both of UITableView and UITableViewCell like this images.

If you implement those in ViewController, it will have been fat. So, escaping those implementation to re namespace property, and hiding those complex implementation. In addition, you can rollback to normal behaviour, only removing 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 only set 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.