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 sort modal on category grid screen #76

Merged
merged 2 commits into from
Feb 5, 2018

Conversation

radyslavkrechet
Copy link
Contributor

No description provided.

@@ -50,4 +50,7 @@ class GridCollectionViewController<T: GridCollectionViewModel>: BaseCollectionVi
selectedProduct = product
performSegue(withIdentifier: SegueIdentifiers.toProductDetails, sender: self)
}

func provider(_ provider: GridCollectionProvider, didScroll scrollView: UIScrollView) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this empty method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we override it in a subclass. We can't implement optional method of the protocol without whit empty implementation in parent class.

sortVariantsViewController.selectedSortingValue = viewModel.selectedSortingValue
}
}

// MARK: - Setup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadData() method don't need in Setup logic block, move comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have all methods that setup view or change view's content under "setup" mark, include this method. We do it with this way in other classes, for example in account view controller, order detail view controller etc. I think we don't need use one more mark in controller to separate this method from others in setup block.

@@ -61,4 +100,39 @@ class CategoryViewController: GridCollectionViewController<CategoryViewModel> {
override func infinityScrollHandler() {
viewModel.loadNextPage()
}

// MARK: - GridCollectionProviderDelegate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it to extension if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't override methods in class's extensions yet. I guess, it can be possible in feature Swift version.

// MARK: - GridCollectionProviderDelegate

override func provider(_ provider: GridCollectionProvider, didScroll scrollView: UIScrollView) {
guard scrollView.contentSize.height - scrollView.frame.size.height >= scrollView.contentOffset.y && scrollView.contentInset.top + scrollView.contentOffset.y > 0 else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, group logical blocks with parentheses

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain what you mean, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I do next changes?

guard (scrollView.contentSize.height - scrollView.frame.size.height >= scrollView.contentOffset.y) && (scrollView.contentInset.top + scrollView.contentOffset.y > 0) 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.

Yep, that's will be fine

@radyslavkrechet radyslavkrechet merged commit 2c9fb49 into develop Feb 5, 2018
@radyslavkrechet radyslavkrechet deleted the feature/sort_modal branch February 5, 2018 09:10
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

3 participants