iOS Dev Course: UITableView

Maksim Vialykh
3 min readOct 31, 2018

--

How to make infinity feed using just one element and reuse it again and again?

Let’s make a simple project with UITableView in quick guide!

Overview

A table view displays a list of items in a single column. UITableView is a subclass of UIScrollView, which allows users to scroll through the table, although UITableView allows vertical scrolling only. The cells comprising the individual items of the table are UITableViewCell objects; UITableView uses these objects to draw the visible rows of the table. Cells have content—titles and images—and can have, near the right edge, accessory views. Standard accessory views are disclosure indicators or detail disclosure buttons; the former leads to the next level in a data hierarchy and the latter leads to a detailed view of a selected item. Accessory views can also be framework controls, such as switches and sliders, or can be custom views. Table views can enter an editing mode where users can insert, delete, and reorder rows of the table.

Read more on Apple Developer

Preparation

Create a new Single View App project.

Hotkey: shift + command + N

Single View App

Open Main.storyboard

Project Navigator, Main.storyboard file focus

How to add a UITableView to storyboard?

Just press: shift + command + L

Search Table View on elements library

Choose Table View and drag it to storyboard.

Cool. Your first Table View is on scene.

Let’s setup constraints to make Table Size as superview.

Table constraints

Let’s add reference to that table into your module.

  • Open Split mode
  • Press ctrl on view and drag cursor to code
  • Write reference name
  • Press connect
Create reference to table

Open ViewController.swift file.

Modify code in file.

Table DataSource pattern

Run project on simulator.

Table View on Simulator

You’ve done it! Clap! Clap!

Remember, the receipt to success is continuous learning and communication with colleagues including, self-education.

This was a small guide about UITableView and Data Source. Read more on Apple Developer site. Don’t stop self-education.

GitHub project

Subscribe to my account to get notifications about new stories.

If you still have questions — write about it in the comments. I’ll answer them in future articles.

--

--