On coding, tech, privacy, AI and whatever else comes to this mind.

Oh my, hit a nasty crash when using in a collection view using the UIHostingConfiguration.

Crashes whenever I change interface orientation on my phone. Can be reproduced with this trivial snippet:

cell.contentConfiguration = UIHostingConfiguration {
Text("Noooo!")
.frame(width: 150)
}

The frame bit triggers a UICollectionViewRecursion warning and then crashes.

Added details on my blog and filed a radar. Hopefully it'll be fixed, as UIHostingConfiguration is otherwise a good way to get the most out of both SwiftUI and UIKit.

https://adrian.schoenig.me/blog/2023/02/10/uicollectionviewrecursion/