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

Swift 4.2 and Swift 5 #191

Merged
merged 10 commits into from
May 26, 2019
Merged

Swift 4.2 and Swift 5 #191

merged 10 commits into from
May 26, 2019

Conversation

ApolloZhu
Copy link
Contributor

@ApolloZhu ApolloZhu commented Mar 30, 2019

  • Rename delegate methods, introduce SectionInsetReference (for safeArea), and move ItemRenderDirection to follow conventions used in UICollectionViewDelegateFlowLayout
  • Replace CHTCollectionElementKind with UICollectionView.elementKind (why use custom header kind? #185)
  • Hide internal implementations (not used by any public project on GitHub)
  • Use more "Swifty" implementations
  • Remove unused tests
  • Fix Fix for minimumInteritemSpacing #182

Most of the above changes can be migrated with Xcode. However, there is something you need to consider:

Behavior Change

Previously, all cells are "scale aspect fit" based on its ratio and available column width, and a cell will display if either height or width of the item size returned by delegate is ≤ 0. Now default itemWidth(inSection:) will be used if item width returned by delegate is not valid.

- Rewrote/rename in actual Swift
- Add sectionInsetReference, similar to that of flow layout
- Now use default itemWidth when itemSize.width is 0
- Restrict access level
- Integrate other small patches
Works for Swift 5 and 4.2
- Using map instead of append is a +
- Allocating new array instead of replacing old value one by one is a ?. Since columnHeights is unique reference, all modifications will be done in-place. However, there will be N + 1 checks which might be slow (or not).
@chiahsien chiahsien merged commit e453486 into chiahsien:develop May 26, 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