Expedia Apr 22, 2021

SwiftUI with UICollectionView

Article Summary

Kari Grooms from Expedia Group tackles a problem every iOS team faces: how do you start using SwiftUI when your app is built on UICollectionView? Her solution is clever, but comes with some surprising gotchas.

With iOS 13 still in play and UICollectionView powering critical features like search results and discovery feeds, many teams can't wait for LazyVStack. Grooms walks through embedding SwiftUI views inside UICollectionViewCell, complete with proper UIHostingController setup, data passing patterns, and real-world layout challenges from the Vrbo iOS app.

Key Takeaways

Critical Insight

You can embed SwiftUI in UICollectionViewCell, but interactive elements require workarounds and the approach only makes sense for specific use cases.

The article reveals why a simple heart button nearly derailed the entire integration, and shows the exact moment when SwiftUI and UIKit's event handling collide.

Recent from Expedia

Related Articles