Daily iOS
UIKit

Nested scrolling cell design

You need to put a horizontally scrolling UICollectionView inside a UITableViewCell in code (a carousel row like the App Store's Today tab). Who should own the inner collection view's dataSource and delegate?

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 row cell owns the inner collection view and acts as its dataSource/delegate, receiving the row's data at configure time and rendering it. If the outer view controller takes the dataSource for both collections, the indexPaths become two layers deep and bugs follow.

Share a question