JoniVR / VerticalCardSwiper

A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
MIT License
1.39k stars 100 forks source link

Feature/visible background cells #48

Closed stfnhdr closed 5 years ago

stfnhdr commented 5 years ago

Checklist

Motivation and Context

Needed this feature for a own project an saw the help wanted on this feature in the issue tab

closes #40

tried it with different values from 1 to 10 cards on every possible device size

Description

removed this part to enable top stacking cards. if cvMinY > cardMinY + cardHeight + minimumLineSpacing + collectionView.contentInset.top { cvMinY = 0 }

let y = collectionView.bounds.minY - cellHeight * CGFloat(topStackCount) let newRect = CGRect(x: 0, y: y < 0 ? 0 : y, width: collectionView.bounds.maxX, height: collectionView.bounds.maxY) let items = NSArray(array: super.layoutAttributesForElements(in: newRect)!, copyItems: true)

i am very open for improvements because this is kind of a quick shot.

JoniVR commented 5 years ago

Hi @stfnhdr
Thanks for the PR! I'll look into testing this soon!

stfnhdr commented 5 years ago

there's a lint warning - fixing it right now.

stfnhdr commented 5 years ago

added your requested changes, have a good night!

JoniVR commented 5 years ago

Don't worry about the build fail for now, I think it's just the UI Tests that are flaky from time to time and there seems to be no way to manually trigger a rebuild for PR's with travis.. I need to migrate to CircleCI or something different soon anyways..

I'll look into reviewing this in the next few days, thanks again for your awesome work on this!

stfnhdr commented 5 years ago

Ok, i tried the tests before pushing, and they all succeeded.

Thanks, this is by far the best Solution for stacking cards i found! Great Work!

I'll put more effort into this in the future - next goal is to implement the background color fade like shazam.

JoniVR commented 5 years ago

Hmm all seems to work well but I still think the fading needs some work, I think we need to either make only the last card (the one that's going to disappear) fade out or gradually change the color of the cells to match the background color of the VerticalCardSwiperView background. Currently it takes away from the stack effect if all cells start fading once they are not focussed anymore.

stfnhdr commented 5 years ago

changed the fade out to the last card in the stack

stfnhdr commented 5 years ago

hey, please don't forget about this pull request ;)

JoniVR commented 5 years ago

Thanks for reminding me, don't worry, I haven't forgotten, it's on my TODO-list but I'm pretty busy with some other stuff right now. I'll try to review & merge it somewhere in the next few days! Thanks for all the work you've done on this!