In this section, we'll implement the product, wrapping the connection with the server with a protocol so that we can implement the app using a fake local storage for this information.
The list of the products stating the requirements for the app is simple: a grid with two columns is required, which we can implement using UICollectionView
.
First of all, let's change the controller in the Storyboard from a simple UIViewController
to UICollectionviewController
, embed it into UINavigationController
, add a UICollectionViewCell
prototype, and change the parent class accordingly in the Swift file.
Although we are going to set up the collection using a custom flow, we'll set the size of the cell to be a little bigger in order to help us lay out the components:
import UIKit class EcommerceViewController: UICollectionViewController { static func instantiate() -> UIViewController { return UIStoryboard(name: "Ecommerce", bundle: nil)...