-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Pledge Payment Methods] Replace UICollectionView with UIScrollView #772
[Pledge Payment Methods] Replace UICollectionView with UIScrollView #772
Conversation
let imageViewWidthConstraint = self.imageView.widthAnchor | ||
.constraint(equalToConstant: Layout.ImageView.width) | ||
_ = imageViewWidthConstraint | ||
|> \.priority .~ .defaultHigh |
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.
None of these priority settings were needed for this approach.
|
||
self.collectionViewHeightConstraint.constant = self.collectionView.contentSize.height | ||
private func updateScrollViewHeightConstraint() { | ||
self.scrollViewHeightConstraint.constant = self.scrollView.contentSize.height |
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.
So simple.
…native-checkout-credit-card-cell-scrollview
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.
Thank you (so much) for taking a look at this, @justinswart 😄 I left one minor suggestion, but it looks good otherwise.
@@ -228,12 +228,16 @@ public final class RewardCardView: UIView { | |||
} | |||
|
|||
private func setupConstraints() { | |||
let stateImageViewContainerWidthConstraint = self.stateImageViewContainer.widthAnchor | |||
.constraint(equalToConstant: Styles.grid(5)) | |||
stateImageViewContainerWidthConstraint.priority = .defaultHigh |
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.
To be consistent with how we've set priority, could you use this instead?
let stateImageViewContainerWidthConstraint = self.stateImageViewContainer.widthAnchor
.constraint(equalToConstant: Styles.grid(5))
|> \.priority .~ .defaultHigh
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.
😄 i was gonna merge it and make that comment on your PR!
j/k i'll update it.
self.bindViewModel() | ||
self.configureSubviews() |
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.
🙏 ty!
@@ -228,12 +228,16 @@ public final class RewardCardView: UIView { | |||
} | |||
|
|||
private func setupConstraints() { | |||
let stateImageViewContainerWidthConstraint = self.stateImageViewContainer.widthAnchor |
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.
Is this change unrelated?
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 fixes a constraint warning
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.
Tested this out on my iPhone X and it seems ok... I'm still a bit wary of how it will perform on older devices for users with > 10 cards, but given some of the data we've pulled on this I'd be open to giving it a try.
Sure, I don't think anybody's suggesting this is the ultimate long-term solution, it's more just to get us unstuck on this for now. We can certainly iterate on bringing the collection view back but this allows us to have something that works in the interim. |
📲 What
This is my suggested fix for the problematic self-sizing
UICollectionView
that we've been struggling with in thePledgePaymentMethodsViewController
. This is not a view that we expect to show a large amount of cells so I don't think we need to be concerned about view recycling. My suggestion is to replace theUICollectionView
with aUIScrollView
.🤔 Why
We've been fiddling with the self-sizing
UICollectionView
issue for 2 days and I don't think it's worth our time anymore. This works very reliably and has zero constraint warnings, even when resizing with dynamic type.🛠 How
Replace the
UICollectionView
with aUIScrollView
, add the card views to a horizontalUIStackView
and enjoy our lives.👀 See