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

Support for ordering bricks within a section #143

Merged
merged 1 commit into from
Jul 7, 2017
Merged

Conversation

rubencagnie
Copy link
Contributor

Added support to specify which brick is repeated at what index for a section.

Say a section has 2 bricks, that are each repeated 5 times. If the orderDataSource is set, the implementor needs to specify based on the actual index (IndexPath’s item), which brick and index needs to be returned. This gives full control to the implementor to define the order of the bricks

Fixes #139

@codecov-io
Copy link

codecov-io commented Jul 7, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@87c2208). Click here to learn what that means.
The diff coverage is 95.71%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #143   +/-   ##
=========================================
  Coverage          ?   93.42%           
=========================================
  Files             ?       39           
  Lines             ?     3148           
  Branches          ?        0           
=========================================
  Hits              ?     2941           
  Misses            ?      207           
  Partials          ?        0
Impacted Files Coverage Δ
Source/Models/Brick.swift 100% <ø> (ø)
Source/ViewControllers/BrickCollectionView.swift 95% <0%> (ø)
Source/Models/BrickSectionDataSource.swift 100% <100%> (ø)
Source/Models/BrickSection.swift 96.87% <96.87%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87c2208...9924c6f. Read the comment docs.

Added support to specify which brick is repeated at what index for a section.

Say a section has 2 bricks, that are each repeated 5 times. If the `orderDataSource` is set, the implementor needs to specify based on the actual index (IndexPath’s item), which brick and index needs to be returned. This gives full control to the implementor to define the order of the bricks

Fixes #139
@@ -49,7 +49,7 @@ extension BrickSection {
return brickSection.numberOfBricks(in: collection)
}

internal func brickAndIndex(at indexPath: IndexPath, in collection: CollectionInfo) -> (Brick, Int)? {
internal func brickAndIndex(atIndexPath indexPath: IndexPath, in collection: CollectionInfo) -> (Brick, Int)? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use just do brickAndIndex(at indexPath: IndexPath, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is also a func brickAndIndex(atIndex brickIndex: Int, in collection: CollectionInfo) -> (Brick, Int)?, so the atIndexPath is to make the difference

@jay18001 jay18001 merged commit 5aad063 into master Jul 7, 2017
@jay18001 jay18001 deleted the 139-order-bricks branch July 7, 2017 20:53
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.

3 participants