Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created January 16, 2026 13:04
Show Gist options
  • Select an option

  • Save jacobsapps/2c8bd4b0972d2f13cb2284a02a5784a8 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/2c8bd4b0972d2f13cb2284a02a5784a8 to your computer and use it in GitHub Desktop.
final class FeedViewController: UIViewController {
private let viewModel: FeedViewModel
private let assetStore: AssetStore
private let collectionView: UICollectionView
private let statsToolbarView = StatsToolbarView()
private let navBarGradientView = GradientView(
colors: [FeedSpec.NavigationBar.gradientTop, FeedSpec.NavigationBar.gradientBottom],
startPoint: CGPoint(x: 0.5, y: 0.0),
endPoint: CGPoint(x: 0.5, y: 1.0)
)
private var currentStatsItemID: Int?
private var navBarGradientHeightConstraint: NSLayoutConstraint?
// ...
}
extension FeedViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: FeedCell.reuseIdentifier,
for: indexPath
) as? FeedCell else {
return UICollectionViewCell()
}
let item = viewModel.visibleItems[indexPath.item]
cell.configure(with: item, assetStore: assetStore)
cell.onStickerUpdated = { [weak self] itemID, stickerID, centerUnit, scale, rotation in
self?.viewModel.updateSticker(
itemID: itemID,
stickerID: stickerID,
centerUnit: centerUnit,
scale: scale,
rotation: rotation
)
}
cell.onStickerDeleted = { [weak self] itemID, stickerID in
self?.viewModel.deleteSticker(itemID: itemID, stickerID: stickerID)
}
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment