-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Card Visibility #14
Card Visibility #14
Conversation
Adds delegate for card visibility. Also adds scroll view delegate implementation. Cards can now override this functionality to get notified about when the cards scroll view is getting changed and how much of each card is visible on the screen at any time. Adds readme changes to let developers know how to use this functionality. Also adds unit testing to the utility functions.
@dtumer Could you squish all these commits? They are muddying the water since I believe you were testing out git users? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments. Also, did we not want to expose the scroll delegates as well? Possibly for the CardControllers?
* | ||
* @param percentVisible - percentage of the card that is visible in the list of cards | ||
*/ | ||
@objc optional func cardVisibility(percentVisible: CGFloat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include a boolean isVisible
as well? I could imagine users would want a quick check if it is visible or not and then some might care about the percent visible. Instead of having to check if percentVisible == 0.0
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing was that this function doesn't get called unless the card is visible so I thought it was unnecessary. But maybe we could include in the documentation that this method will only be called when the card is actually visible in some way
import Foundation | ||
import CardParts | ||
|
||
class DummyCardController: CardPartsViewController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this still? Or was this just for testing performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was just testing performance I can remove it if we don't need it anymore
import XCTest | ||
@testable import CardParts | ||
|
||
class CardUtilsTests: XCTestCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid tests... great job 👍
|
||
// Notifies your card parts view controller of the percentage of the card that is visible. | ||
// This function is called every time 'scrollViewDidScroll' is called in your CardsViewController. | ||
override func cardVisibility(percentVisible: CGFloat) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decide to add the isVisible
Bool, lets make sure we update the docs.
You could send |
commit 1f1f0bb Author: Tumer, Deniz <e.tumer.deniz@gmail.com> Date: Wed May 23 16:02:29 2018 -0700 removed scrollViewDidScroll method since it isn't necessary commit bc3b4dc Author: Tumer, Deniz <e.tumer.deniz@gmail.com> Date: Wed May 23 15:58:09 2018 -0700 Card visibility Adds delegate for card visibility. Also adds scroll view delegate implementation. Cards can now override this functionality to get notified about when the cards scroll view is getting changed and how much of each card is visible on the screen at any time. Adds readme changes to let developers know how to use this functionality. Also adds unit testing to the utility functions. commit c8e0009 Author: Tumer, Deniz <e.tumer.deniz@gmail.com> Date: Wed May 23 09:49:19 2018 -0700 testing commit a5ae870 Author: Tumer, Deniz <> Date: Wed May 23 09:46:08 2018 -0700 test commit 9bbf3ce Author: Tumer, Deniz <> Date: Wed May 23 09:44:47 2018 -0700 tst commit cbfeed9 Author: Tumer, Deniz <> Date: Wed May 23 09:40:10 2018 -0700 another test commit 38fa7ce Author: Tumer, Deniz <> Date: Wed May 23 09:28:44 2018 -0700 Another test commit 3f9b966 Author: Tumer, Deniz <e.tumer.deniz@gmail.com> Date: Wed May 23 09:27:58 2018 -0700 Another test commit 9cfb76a Author: Tumer, Deniz <Deniz_Tumer@intuit.com> Date: Wed May 23 09:25:43 2018 -0700 testing commit 38697cb Author: Tumer, Deniz <Deniz_Tumer@intuit.com> Date: Wed May 23 09:19:41 2018 -0700 commit commit da6b380 Author: Tumer, Deniz <Deniz_Tumer@intuit.com> Date: Wed May 23 09:17:47 2018 -0700 test Squashed commits
…rts into feature/card-visibility
Adds a listener in CardPartsViewController that allows for custom CardPartsViewControllers to be notified of the visibility of the card within a custom CardsViewController implementation.
Every time scrollViewDidScroll() is called in the CardsViewController the corresponding "cardVisibility(percentVisible: CGFloat)" function is called if the card in question is visible within the bounds of the scroll view. The card is then notified of the percentage of itself that is visible.