Here's a sample code to build a 9 by 9 grid using UIViews in Swift:
main.swift488 chars13 lines
This code creates a 9 by 9 grid with the help of two nested for loops. We first calculate the height and width of a single cell by dividing the container view bounds with the grid size. Then, for each cell, we create a UIView with the calculated size and add it as a subview to the container view. We also set a black border for each cell for better visibility.
gistlibby LogSnag