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
Add collection view for menu view #17
Conversation
@AAAstorga any idea why bitrise errors on the review? |
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.
This branch should be jaewon/menu-view
, can you rename your branch with git branch -m []
and git push --force
?
Also, shouldn't @YKo20010 be added on all of your PRs?
|
||
var titleLabel: UILabel! | ||
var ingredientsLabel: UILabel! | ||
var detailStackView: UIStackView! //include title and ingredients |
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.
space after //
selectButton = UIButton() | ||
selectButton.layer.cornerRadius = 8 | ||
selectButton.setTitle("Select", for: .normal) | ||
selectButton.backgroundColor = UIColor(red: 1.0, green: 156.0 / 255.0, blue: 29.0 / 255.0, alpha: 1.0) |
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.
this should be defined in UIColor
, and not here
let selectButtonWidth: CGFloat = 84 | ||
let imageViewWidthHeight: CGFloat = 64 | ||
let imageViewStackViewHorizontalSpacing: CGFloat = 24 | ||
let stackViewSelectButtonHorizontalSpacing: CGFloat = 17 |
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.
@kevinchan159 should this code be here or at the top of the file?
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.
No, we're changing constants conventions to keep them at the top of the function. @young-k
} | ||
|
||
// MARK: Constraint setup | ||
private func setUpConstraints() { |
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 be setupConstraints
, not setUpConstraints
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.
When this discussion happened last year on Recast we decided to go with setUp because it's in the verb form of "setting up" constraints -- are we changing this? @drewsdunne
detailStackView.snp.makeConstraints { make in | ||
make.leading.equalTo(imageView.snp.trailing).offset(imageViewStackViewHorizontalSpacing) | ||
make.centerY.equalToSuperview() | ||
make.trailing.equalTo(selectButton.snp.leading).offset(-stackViewSelectButtonHorizontalSpacing) |
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.
centerY
should be before leading
, it's alphabetical and more logical
var detailStackView: UIStackView! //include title and ingredients | ||
|
||
var additionalPricingLabel: UILabel! | ||
var selectButton: UIButton! |
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.
prefer that these variables are alphabetized or grouped by type, up to @drewsdunne or @kevinchan159
// MARK: Lifecycle | ||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
|
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.
does a newline here add clarity to the code? if not, it can be removed!
} | ||
|
||
// MARK: Constraint setup | ||
func setUpConstraints() { |
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.
shouldn't this be private
? you put it up top, but not here
@young-k bitrise is not setup for this one yet. I'm working on it |
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.
LGTM!! just left some comments
contentView.addSubview(detailStackView) | ||
|
||
detailStackView.addArrangedSubview(titleLabel) | ||
detailStackView.addArrangedSubview(ingredientsLabel) |
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.
you can pass this in through the init UIStackView(arrangedSubviews: [...])
|
||
titleLabel = UILabel() | ||
titleLabel.font = UIFont.systemFont(ofSize: 17, weight: .bold) | ||
titleLabel.textColor = .black |
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.
any reason why we aren't adding to contentView
} | ||
|
||
// MARK: Constraint setup | ||
func setUpConstraints() { |
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.
add private
and change to setupConstraints
// MARK: Constraint setup | ||
func setUpConstraints() { | ||
collectionView.snp.makeConstraints { make in | ||
make.edges.equalToSuperview() |
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 don't think make.edges
pins the top and bottom to the safeAreaLayoutGuide
currentMenuItem = object | ||
} else { | ||
return | ||
} |
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.
you can simplify to currentMenuItem = object as? MenuItem
class MenuViewController: UIViewController { | ||
|
||
var collectionView: UICollectionView! | ||
var adapter: ListAdapter! |
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.
Could we call this listAdapter to be consistent with our other view controllers.
Resolves #8