You are building a small iOS prototype in Xcode (Swift). You may use SwiftUI or UIKit.
Implement a scrollable square grid of cells.
Incrementally add the following requirements:
-
Fixed grid
-
Render a grid with a fixed number of rows/columns.
-
Each cell is a square.
-
Tapping a cell changes that cell’s color.
-
Configurable dimensions + random color
-
The number of rows/columns is provided externally (e.g., initializer parameters).
-
Each tap changes the tapped cell to a
random color
.
-
Navigate to a detail screen
-
After tapping a cell, also navigate to a detail screen that displays the new color.
-
Edit in detail and propagate back
-
On the detail screen, allow changing the color.
-
When navigating back, the updated color must be reflected in the grid.
Discuss:
-
Data model/state management
-
How you would structure navigation
-
How you would ensure cells remain square while scrolling