TOInsetGroupedTableView

TOInsetGroupedTableView is a subclass of UITableView that back-ports the new "inset grouped" visual style introduced in iOS 13 to older versions of iOS.

On iOS 13 and above, it defers back to using the system implementation, meaning absolutely no extra configuration code is required.

This library is fantastic for developers adopting the new rounded corners style of table views in their apps, but are still supporting iOS 12.

Features

  • Brings the modern rounded corners look to table views in previous versions of iOS.
  • All override behaviour is contained in the table view. No modifications of the cell views themselves is required.
  • Defers back to the system implementation on iOS 13 and higher.
  • As the code is only ever executed below iOS 13, there is no chance of future iOS releases breaking the build.

Requirements

  • Xcode 11.0 or higher.
  • iOS 12.0 or higher (iOS 11 should work, but it still needs testing.)

Installation

Manual Installation

  1. Download the latest version of the TOInsetGroupedTableView repository.
  2. Inside the repository, copy the TOInsetGroupedTableView folder to your own Xcode project.
  3. Optionally, in Swift, make sure to add the header file to your Swift bridging header.

CocoaPods

In your app's Podfile, add:

pod 'TOInsetGroupedTableView'

Usage

Integrating TOInsetGroupedTableView is extremely simple as it introduces no new APIs or changes any external inputs. All that is needed is to replace UITableView() instantiations with TOInsetGroupedTableView().

Swift

In Swift, the class is renamed to InsetGroupedTableView. In order to integrate it, simply replace any instances of

self.tableView = UITableView(frame: .zero, style: .insetGrouped)

with

self.tableView = InsetGroupedTableView(frame: .zero)

No other changes are needed.

Objective-C

Just like in Swift, all that is required is to rename any instantiations of UITableView with TOInsetGroupedTableView.

For example, simply replace any instances of:

self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleInsetGrouped];

with

self.tableView = [[TOInsetGroupedTableView alloc] initWithFrame:CGRectZero];

GitHub