Skip to content

Instantly share code, notes, and snippets.

@gwennguihal
Created February 26, 2019 08:06
Show Gist options
  • Save gwennguihal/743e534d239b1b2768a8f8c92973b10d to your computer and use it in GitHub Desktop.
Save gwennguihal/743e534d239b1b2768a8f8c92973b10d to your computer and use it in GitHub Desktop.
public final class DecorationBlock {
public let type: DecorationBlockType
unowned var sectionDescriptor: CollectionSectionDescribable
var startItemIndex: Int
var endItemIndex: Int
var firstIndexPath: IndexPath? {
guard let sectionIndex = sectionDescriptor.index else {
return nil
}
return IndexPath(item: startItemIndex, section: sectionIndex)
}
var endIndexPath: IndexPath? {
guard let sectionIndex = sectionDescriptor.index else {
return nil
}
return IndexPath(item: endItemIndex, section: sectionIndex)
}
init(type: DecorationBlockType, startItemIndex: Int, sectionDescriptor: CollectionSectionDescribable) {
self.type = type
self.startItemIndex = startItemIndex
self.endItemIndex = startItemIndex
self.sectionDescriptor = sectionDescriptor
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment