xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

Allow us to leverage UICollectionViewCompositionalLayout on iOS13 #8095

Open adrianknight89 opened 5 years ago

adrianknight89 commented 5 years ago

Summary

Apple introduced UICollectionViewCompositionalLayout recently that we should be able to leverage in Xamarin Forms. According to the information I could find, it is easier to use, fast, and allows complex designs.

https://medium.com/flawless-app-stories/all-what-you-need-to-know-about-uicollectionviewcompositionallayout-f3b2f590bdbe

https://dev.to/kevinmaarek/using-collectionview-compositional-layouts-in-swift-5-1nan

https://iosexample.com/backport-of-uicollectionviewcompositionallayout-to-earlier-ios-12/

https://developer.apple.com/videos/play/wwdc2019/215/

This layout, in my opinion, should be the default for iOS13+. Considering Apple pushes updates aggressively and most people end up using the latest SDK, I bet this would eventually be the most used layout on iOS. For iOS12 and below, the flow layout should be used.

Currently, CollectionView performance on iOS isn't up to par with Android and this could help make it faster and easier to maintain.

adrianknight89 commented 5 years ago

Another thing to keep in mind is using diffable data to avoid issues like (which has come up several times on Forms already):

Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (213) must be equal to the number of items contained in that section before the update (154), plus or minus the number of items inserted or deleted from that section (40 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).’

https://medium.com/snowdog-labs/first-look-at-diffable-data-sources-in-ios-13-d7d4ef0e0cb3