MaherKSantina / MSPeekCollectionViewDelegateImplementation

A custom paging behavior that peeks the previous and next items in a collection view
https://medium.com/@maher.santina90/how-to-create-cells-that-peek-on-the-sides-like-ios-11-app-store-ef4bb54c0c7d
MIT License
356 stars 32 forks source link

Better handling of negative cellSpacing #71

Closed tomasandrle closed 3 years ago

tomasandrle commented 3 years ago

Avoid glitching when cellSpacing is set to a negative value.

MaherKSantina commented 3 years ago

Thanks @tomasandrle for raising this PR! 🙏 What do you think about removing negative spacing support all together (Instead of having a Bool to specify that). Will there be a case where we need negative spacing?

tomasandrle commented 3 years ago

I needed this to fix my layout. I applied a scale transform to cells going out of view (to make them look smaller) and setting negative spacing helped me achieve the desired layout.

I'm not sure about the elegance of my fix (bool) but I definitely need it - it's not a theoretical thing, if you know what I mean.

I totally understand that this is an edge case in a general purpose library.

MaherKSantina commented 3 years ago

Ohh thanks for the detailed explanation! If that's the case then I'm happy with the fix Great Job 👍

tomasandrle commented 3 years ago

You're right, that was lazy of me. I'll re-test and improve the patch.

On 2021 Feb 26, at 7:20, Maher Santina notifications@github.com wrote:

@MaherKSantina requested changes on this pull request.

Sorry @tomasandrle I just tried to build it for the example app in the project and it looks like it breaks the current implementation. What do you think we make it backward compatible by specifying a default value to the m variable? And also, do you think we can change the variable m to something more expressive? Like allowNegativeValues: Bool ? Sorry about that 😢

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.