Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #128 from zenangst/Defect/Negative-item-index-for-…
Browse files Browse the repository at this point in the history
…footer-reference

Fix negative index
  • Loading branch information
christoff-1992 authored Sep 18, 2019
2 parents bfa823a + f2abd7f commit 7598584
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Blueprints.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Blueprints"
s.summary = "A collection of flow layouts that is meant to make your life easier."
s.version = "0.12.1"
s.version = "0.12.2"
s.homepage = "https://github.com/zenangst/Blueprints"
s.license = 'MIT'
s.author = { "Christoffer Winterkvist" => "[email protected]" }
Expand Down
7 changes: 6 additions & 1 deletion Sources/Shared/Core/VerticalBlueprintLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ import UIKit

let indexOffset = 1
let lastHeaderReferenceHeight = resolveSizeForSupplementaryView(ofKind: .header, at: IndexPath(item: 0, section: numberOfSections - indexOffset)).height
let lastFooterReferenceHeight = resolveSizeForSupplementaryView(ofKind: .footer, at: IndexPath(item: numberOfItemsInSection(numberOfSections - indexOffset), section: numberOfSections - indexOffset)).height
let lastFooterReferenceHeight: CGFloat
if numberOfSections < 0 {
lastFooterReferenceHeight = resolveSizeForSupplementaryView(ofKind: .footer, at: IndexPath(item: numberOfItemsInSection(numberOfSections - indexOffset), section: numberOfSections - indexOffset)).height
} else {
lastFooterReferenceHeight = footerReferenceSize.height
}

contentSize.height += lastHeaderReferenceHeight + lastFooterReferenceHeight
contentSize.width = threshold
Expand Down
7 changes: 6 additions & 1 deletion Sources/Shared/Mosaic/VerticalMosaicBlueprintLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@

let indexOffset = 1
let lastHeaderReferenceHeight = resolveSizeForSupplementaryView(ofKind: .header, at: IndexPath(item: 0, section: numberOfSections - indexOffset)).height
let lastFooterReferenceHeight = resolveSizeForSupplementaryView(ofKind: .footer, at: IndexPath(item: numberOfItemsInSection(numberOfSections - indexOffset), section: numberOfSections - indexOffset)).height
let lastFooterReferenceHeight: CGFloat
if numberOfSections < 0 {
lastFooterReferenceHeight = resolveSizeForSupplementaryView(ofKind: .footer, at: IndexPath(item: numberOfItemsInSection(numberOfSections - indexOffset), section: numberOfSections - indexOffset)).height
} else {
lastFooterReferenceHeight = footerReferenceSize.height
}
contentSize.height += lastHeaderReferenceHeight + lastFooterReferenceHeight
contentSize.width = threshold

Expand Down

0 comments on commit 7598584

Please sign in to comment.