Create a UITableViewCell Programmatically

Use the functions, but well

Steven Curtis

--

Before we start

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.5, and Swift 5.4

The introduction

This project is intended to create a UITableViewCell in an entirely programmatic fashion. Read on to find out about this!

Prerequisites:

Terminology

UIViewController: A view controller is an intermediary between the views it manages and the data of your app

Load the ViewController

So in the SceneDelegate add the following:

which will load a simple UIViewController called ViewController.

Now we will need to delete the Storyboard, and remove the reference from the project and the plist. The whole process is described in the following guide

Adding an image to Assets

I’ve added a placeholder image called PlaceholderImage.png. This is a relatively simple process, we can drag and drop the image into the asset catalog. To do so we can select the Asset catalog from the project inspector:

and then can drag and drop the image into the catalog:

This will then be referred to later in this article (and in the attached repo)

--

--