ReverseExtension
  • October 7, 2023

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.re.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 5
  • Xcode 12 or greater
  • iOS 10 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.

GitHub


View Github

#extension #reverse #uitableview #uitableviewcell
YOU MIGHT ALSO LIKE...
EEStackLayout

A vertical stackview which takes subviews with different widths and adds them to it's rows with paddings, spacings etc.

AudioManager

AudioManager is a Swift package that provides a modular and easy-to-use interface for implementing audio feedback in your applications. It ...

CameraBackground

Features Both front and back camera supported. Flash modes: auto, on, off. Countdown timer. Tap to focus. Pinch to zoom. Usage  

DKCamera

Description A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so ...