Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Add collection view for menu view #17

wants to merge 2 commits into from

Conversation

jaewonsim
Copy link
Contributor

Resolves #8

  • Add IGListKit-based menu view
  • Navigation controller to be implemented

@jaewonsim jaewonsim requested a review from doctor3w March 23, 2019 02:14
@young-k
Copy link

young-k commented Mar 23, 2019

@AAAstorga any idea why bitrise errors on the review?

Copy link

@young-k young-k left a 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
Copy link

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)
Copy link

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
Copy link

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?

Copy link
Contributor

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() {
Copy link

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

Copy link
Contributor Author

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)
Copy link

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

acai-ios/MenuViewController.swift Show resolved Hide resolved
var detailStackView: UIStackView! //include title and ingredients

var additionalPricingLabel: UILabel!
var selectButton: UIButton!
Copy link

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)

Copy link

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() {
Copy link

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

@doctor3w
Copy link
Contributor

@young-k bitrise is not setup for this one yet. I'm working on it

Copy link
Contributor

@kevinchan159 kevinchan159 left a 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)
Copy link
Contributor

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
Copy link
Contributor

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() {
Copy link
Contributor

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()
Copy link
Contributor

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
}
Copy link
Contributor

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!
Copy link
Contributor

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.

@jaewonsim jaewonsim closed this Mar 24, 2019
@doctor3w doctor3w deleted the menu-view branch April 16, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants