Daily iOS
UIKit

Cell impression tracking

Each post in a feed has to send an impression event exactly once when it has been at least 50% visible for at least 1 second. How would you design this impression tracker on top of UITableView/UICollectionView?

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

A tracker on the controller side registers candidates in willDisplay/didEndDisplaying, computes the visible ratio in scrollViewDidScroll from the overlap between the cell frame and the viewport, and sends the event once 1 second has passed since the ratio crossed 50%.

Share a question