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

Support safe area insets where appropriate #37

Open gcox opened 5 years ago

gcox commented 5 years ago

Currently, the safe area is ignored. If a collection view is rendered on an iPhone X in landscape, the cells under run the safe area. A workaround is to add the left or right safe area inset to the cellPeekWidth and reconfigure the delegate implementation when the view transitions sizes. Easy enough, but feels like it should be handled automatically or as another configuration argument.

MaherKSantina commented 5 years ago

Thank you @gcox for raising this issue! I just checked it on iPhone X and you're right it's not being positioned properly, I'll look into it as soon as possible.

MaherKSantina commented 5 years ago

Hello @gcox ! Apologies it's been a while since I got back to you. I've been looking into this and it feels that this problem is related to any flow layout not just this implementation. Also, this implementation doesn't know the hierarchy outside its collection view, and I think it's better this way. Otherwise, this implementation would be doing too much and it defies the separation of concerns concept. I understand that you don't want to implement this in the view controller to avoid the repetition of code, but we might be able to create an extension for UIViewController which fixes this problem and we can use that instead. Either ways, it's something we can do for a regular collection view also to avoid having the cells span behind the notch. Let me know your thoughts about that 👍