Daily iOS
Architecture

Reusable UI component boundaries

On a UIKit cart screen, the product card is used in the list, in search, and in recommendations, but the tap behavior and badges differ per screen. When you design a reusable UICollectionViewCell component, which inputs and events would you expose on the cell, and nothing more?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

The cell takes a configuration struct holding only what it needs to draw, like image URL, title, price, and badge text, and reports user actions like tap or add-to-cart outward through a closure carrying the product id, without knowing any per-screen policy.

Share a question