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

Update to Swift 5.0 #42

Merged
merged 2 commits into from
Apr 10, 2019
Merged

Update to Swift 5.0 #42

merged 2 commits into from
Apr 10, 2019

Conversation

vkcldhkd
Copy link
Contributor

@vkcldhkd vkcldhkd commented Apr 9, 2019

Update to Swift 5.0 :)

Copy link
Owner

@BenEmdon BenEmdon left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution 👏 I really appreciate it 😄

I have some style comments you to address 👇

Is the default: case required in Swift 5? Or are you adding it for logical completeness?

@@ -31,7 +31,10 @@ open class CenteredCollectionViewFlowLayout: UICollectionViewFlowLayout {
return itemSize.width + minimumLineSpacing
case .vertical:
return itemSize.height + minimumLineSpacing
}

Copy link
Owner

Choose a reason for hiding this comment

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

Nitpick: remove this extra newline

Suggested change


default:
return 0
}
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?


default:
collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionView.contentOffset = .zero
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?

@@ -111,6 +118,9 @@ open class CenteredCollectionViewFlowLayout: UICollectionViewFlowLayout {
newOffset += velocity.y > 0 ? pageHeight : -pageHeight
}
return CGPoint(x: proposedContentOffset.x, y: newOffset)

default:
return .zero
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?


default:
proposedContentOffset = .zero
shouldAnimate = false
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?

@@ -148,6 +162,8 @@ private extension CenteredCollectionViewFlowLayout {
origin = CGPoint(x: proposedContentOffset.x, y: collectionView.contentOffset.y)
case .vertical:
origin = CGPoint(x: collectionView.contentOffset.x, y: proposedContentOffset.y)
default:
origin = .zero
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?

@@ -166,6 +182,8 @@ private extension CenteredCollectionViewFlowLayout {
proposedCenterOffset = proposedContentOffset.x + collectionView.bounds.size.width / 2
case .vertical:
proposedCenterOffset = proposedContentOffset.y + collectionView.bounds.size.height / 2
default:
proposedCenterOffset = .zero
Copy link
Owner

Choose a reason for hiding this comment

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

The spacing here doesn't match the rest of the code. Would you mind making the stacking consistent with the rest of the file?

@vkcldhkd
Copy link
Contributor Author

Below are excerpts from https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html :)

"Every switch statement must be exhaustive. That is, every possible value of the type being considered must be matched by one of the switch cases. If it’s not appropriate to provide a case for every possible value, you can define a default case to cover any values that are not addressed explicitly. This default case is indicated by the default keyword, and must always appear last."

Copy link
Owner

@BenEmdon BenEmdon left a comment

Choose a reason for hiding this comment

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

Awesome work 💯 Your contribution is greatly appreciated 👏

@BenEmdon BenEmdon merged commit d5300f3 into BenEmdon:master Apr 10, 2019
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.

2 participants