-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
@@ -50,4 +50,7 @@ class GridCollectionViewController<T: GridCollectionViewModel>: BaseCollectionVi | |||
selectedProduct = product | |||
performSegue(withIdentifier: SegueIdentifiers.toProductDetails, sender: self) | |||
} | |||
|
|||
func provider(_ provider: GridCollectionProvider, didScroll scrollView: UIScrollView) { |
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 empty method?
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.
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 |
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.
loadData() method don't need in Setup logic block, move comment
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.
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 |
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.
Move it to extension if possible
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.
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 { |
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.
Please, group logical blocks with parentheses
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 you explain what you mean, please?
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 I do next changes?
guard (scrollView.contentSize.height - scrollView.frame.size.height >= scrollView.contentOffset.y) && (scrollView.contentInset.top + scrollView.contentOffset.y > 0) 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.
Yep, that's will be fine
No description provided.