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

Overview

ReverseExtension

Version Language License Platform Carthage compatible

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.

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.

Comments
  • Terminating app due to uncaught exception 'NSInternalInconsistencyException'

    Terminating app due to uncaught exception 'NSInternalInconsistencyException'

    I am getting this error, after I hit Back in the navigation controller. My ChatViewController (which uses ReverseExtension) is succesfully deiniting as you can see from the logs below, also another observer that I use (ContextWatcher) is deiniting as well.

    I put a break point in deinit and the below error occures before the break point. Any ideas?

    [00070]:ChatViewController.swift :deinit........................ :10:26:52 ------------------------- [00071]:ChatViewController.swift :deinit........................ :10:26:52 | ViewController deinit | [00072]:ChatViewController.swift :deinit........................ :10:26:52 ------------------------- [00075]:CDContextWatcher.swift :deinit........................ :10:26:52 DEINIT ContextWatcher 2017-04-02 10:26:52.602283 LetsGoApp[401:153893] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x1031e0a00 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x1708390e0> ( <NSKeyValueObservance 0x170a5b780: Observer: 0x1701cb8b0, Key path: contentInset, Options: <New: YES, Old: YES, Prior: NO> Context: 0x0, Property: 0x17084d200> )'

    opened by ghost 9
  • origin table is reversed

    origin table is reversed

    Excuse me, I have a tableview to show all things, after I install your framework, and use in my target page, until here is fine, but when I back the last page the tableview is reverse.

    ask1

    opened by yfde11 5
  • Crash in Object-C

    Crash in Object-C

    UMLOG: error: session_id=0A305CA2267A57BCE3328B677E10407C, context=An instance 0x7fab039b2400 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x61000023b420> ( <NSKeyValueObservance 0x61000045e690: Observer: 0x6100001de4b0, Key path: contentInset, Options: <New: YES, Old: YES, Prior: NO> Context: 0x0, Property: 0x608000440d80>

    Can you help me with this problem?

    opened by jihongboo 4
  • Crash When Scrolling to the Top

    Crash When Scrolling to the Top

    In Xcode 10/Swift 4.2/iOS 12 Simulator, both my app and the included sample app crash if there are tableviewcells on the table and you try to scroll beyond the top of the view.

    The issue doesn't seem to appear in Xcode 9/Swift 4.1/iOS 11.

    opened by mredig 3
  • Autocorrect-bubble reversed

    Autocorrect-bubble reversed

    I tried something similar a while ago when implementing a messenger-functionality in our app. We came up with the same idea of reverting the tableview and then reverting the cells. So, the cell at the bottom contained a UITextField to enter the text to the other user. A problem we stumbled upon was the autocorrect-bubble: screen shot 2017-05-10 at 08 02 12 In this example i just added a textfield to the cell to see what happens… if you type in something and autocorrect comes up with some better stuff, the bubble is reversed. We tried to walk through the view-hierarchy to rotate the bubble, but no solution was satisfying... do you have any idea how to take care of this?

    opened by senfi 3
  • Swift 5

    Swift 5

    Is there any chance to update this library to support swift 5 ? I tried to compile it against swift 5 (after fixing a few renames), but it looks like it always gets the first item from the datasource (using similar setup from the sample project)

    opened by alexwibowo 2
  • The screen turn upside down

    The screen turn upside down

    I updated to 0.4.5 and found out a bug. The screen(tableview) will always turn upside down then I pop a view controller. This bug only appears on 0.4.5.

    opened by jihongboo 2
  • Xcode 12

    Xcode 12

    Also going to create a Swift 5 PR, but first updated codebase to build Sample with Xcode 12 anyways.👌

    • [x] Updated TouchVisualizer.
    • [x] Updated Sample layout to expand nicely under safe-areas.
    opened by toshi0383 1
  • Updates so that 4.2 will work with this extension

    Updates so that 4.2 will work with this extension

    Hello @marty-suzuki I made some changes to the ReverseExtension.swift so that it would be compatible with Swift 4.2. They're some minor changes if you wanted to add them to your repository. But no pressure. Great extension, I appreciate it ;)

    opened by sunnysidesounds 1
  • Error in Xcode9 Swift 4

    Error in Xcode9 Swift 4

    On line 163 in ReverseExtension.swift

                contentInsetObserver?.didChange = { [weak self] _ in
                    DispatchQueue.main.async {
                        self?.configureTableViewInsets()
                    }
                }
    

    Gives a compile error.

    Changing it to:

                contentInsetObserver?.didChange = { [weak self] (_, _) in
                    DispatchQueue.main.async {
                        self?.configureTableViewInsets()
                    }
                }
    

    Works.

    opened by helloniklas 1
  • fix reversedIndexPath if sections are used

    fix reversedIndexPath if sections are used

    I found an error in the reversedIndexPath method if sections are used. I tested this fix for my own application and it works as expected but if you have a better idea I would be interested to hear about it. The problem is that the number of rows in section was always determined using the section from the given IndexPath and calling the UITableView method numberOfRows(inSection:). However, if I called the methods in my ViewController the reversedIndexPath should have been used. #22

    opened by sattler 1
  • Replace DelegateProxy with concrete forward implementation

    Replace DelegateProxy with concrete forward implementation

    fixes: Issues like https://github.com/marty-suzuki/ReverseExtension/issues/23 , https://github.com/marty-suzuki/ReverseExtension/issues/36

    I faced this non-reversed index issue with willDisplay delegate.

    opened by toshi0383 3
  • Custom section header view not working.

    Custom section header view not working.

    Hi,

    If I use method for custom section header view than header is not presented properly:

    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?

    Can you provide me instructions what should I do to make this work, thank you.

    opened by DavidTomic 3
  • Scroll Bar showing on left side instead of right side

    Scroll Bar showing on left side instead of right side

    I have implemented this into my project and everything works great except the scroll bar is showing on the left side instead of the right side. Is there a way to make it show on the right side?

    opened by ryandailey100 0
Owner
Taiki Suzuki
AbemaTV / University of Aizu 18th
Taiki Suzuki
Easy UITableView drag-and-drop cell reordering

SwiftReorder NOTE: Some users have encountered compatibility issues when using this library with recent versions of iOS. For apps targeting iOS 11 and

Adam Shin 378 Dec 13, 2022
a TableView have thumbnail cell only, and you can use gesture let it expands other expansionView, all diy

ZYThumbnailTableView #####可展开型预览TableView,开放接口,完全自由定制 #####An expandable preview TableView, custom-made all the modules completely with open API you c

null 950 Oct 17, 2022
Use Yelp API to fetch restuarants around a location and show them in a table view

Yelp Use Yelp API to fetch restuarants around a location and show them in a table view - Infinite scrolling, Prefetching, Image Caching. Design Patter

null 0 Nov 1, 2021
Using UI Table View

News-App Table View와 Table view controller Table View : Table의 크기를 지정할 수 있다. Table View Controller: 전체의 뷰가 하나의 테이블 Table View Table view 구성요소 결정하기 어떤

Jiwon 0 Dec 9, 2021
Typed, yet Flexible Table View Controller

ConfigurableTableViewController Simple view controller that provides a way to configure a table view with multiple types of cells while keeping type s

Arek Holko 270 Oct 15, 2022
Generic table view controller with external data processing

FlexibleTableViewController Swift library of generic table view controller with external data processing of functionality, like determine cell's reuse

Dmytro Pylypenko 9 May 20, 2018
TableViews - Emoji Table View For iOS With Swift

TableViews Hello! This is EmojiTableView. Let me introduce you my first app when

null 0 Jan 2, 2022
Simple static table views for iOS in Swift.

Simple static table views for iOS in Swift. Static's goal is to separate model data from presentation. Rows and Sections are your “view models” for yo

Venmo 1.3k Nov 19, 2022
A Swift library for swipeable table cells

BWSwipeRevealCell Using the library **Note: Use version 1.0.1 for Swift 2.3 support and version 2.0.0 or higher for Swift 3 support ** There are two m

Kyle Newsome 67 May 11, 2022
Type-safe declarative table views.

TableKit TableKit is a super lightweight yet powerful generic library that allows you to build complex table views in a declarative type-safe manner.

Max Sokolov 694 Dec 13, 2022
This framework allows you to build Table views using UIKit with syntax similar to SwiftUI

This framework allows you to build Table views using UIKit with syntax similar to SwiftUI

Fun 60 Dec 17, 2022
INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application

INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application. MultilevelTableView is a simple component, which lets you use the tableview with multilevel tree view in your project.

INTUZ 3 Oct 3, 2022
A PageView, which supporting scrolling to transition between a UIView and a UITableView

YXTPageView ##A Page View, which support scrolling to transition between a UIView and a UITableView UIView (at the top) UITableView (at the bottom) In

Hanton Yang 68 May 25, 2022
A declarative api for working with UITableView.

⚡️ Lightning Table Lightning Table provides a powerful declarative API for working with UITableView's. Table views are the foundation of almost every

Electric Kangaroo 28 Aug 25, 2021
A simple way to create a UITableView for settings in Swift.

QuickTableViewController A simple way to create a table view for settings, including: Table view cells with UISwitch Table view cells with center alig

Cheng-Yao Lin 525 Dec 20, 2022
Simple and beautiful stacked UIView to use as a replacement for an UITableView, UIImageView or as a menu

VBPiledView simple but highly effective animation and interactivity! By v-braun - viktor-braun.de. Preview Description Very simple and beautiful stack

Viktor Braun 168 Jan 3, 2023
A pixel perfect replacement for UITableView section index, written in Swift

MYTableViewIndex MYTableViewIndex is a re-implementation of UITableView section index. This control is usually seen in apps displaying contacts, track

Yury 520 Oct 27, 2022
A cells of UITableView can be rearranged by drag and drop.

TableViewDragger This is a demo that uses a TableViewDragger. Appetize's Demo Requirements Swift 4.2 iOS 8.0 or later How to Install TableViewDragger

Kyohei Ito 515 Dec 28, 2022