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 #132 from zenangst/fix/exclude-empty-sections
Browse files Browse the repository at this point in the history
Fix/exclude empty sections
  • Loading branch information
christoff-1992 authored Sep 20, 2019
2 parents 2102342 + 248c7cf commit ba906ce
Show file tree
Hide file tree
Showing 3 changed files with 9 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.2"
s.version = "0.13.0"
s.homepage = "https://github.com/zenangst/Blueprints"
s.license = 'MIT'
s.author = { "Christoffer Winterkvist" => "[email protected]" }
Expand Down
5 changes: 4 additions & 1 deletion Sources/Shared/Core/HorizontalBlueprintLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
var widthOfSection: CGFloat = 0

for section in 0..<sections {
let numberOfItems = numberOfItemsInSection(section)
guard numberOfItems > 0 else {
continue
}
widthOfSection = 0
var firstItem: LayoutAttributes? = nil
var previousItem: LayoutAttributes? = nil
Expand All @@ -142,7 +146,6 @@
let sectionIndexPath = IndexPath(item: 0, section: section)
let sectionsMinimumInteritemSpacing = resolveMinimumInteritemSpacing(forSectionAt: section)
let sectionsMinimumLineSpacing = resolveMinimumLineSpacing(forSectionAt: section)
let numberOfItems = numberOfItemsInSection(section)
let headerSize = resolveSizeForSupplementaryView(ofKind: .header, at: sectionIndexPath)

if headerSize.height > 0 {
Expand Down
5 changes: 4 additions & 1 deletion Sources/Shared/Core/VerticalBlueprintLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,15 @@ import UIKit
var nextY: CGFloat = 0

for section in 0..<sections {
let numberOfItems = numberOfItemsInSection(section)
guard numberOfItems > 0 else {
continue
}
var previousAttribute: LayoutAttributes? = nil
var headerAttribute: SupplementaryLayoutAttributes? = nil
let sectionIndexPath = IndexPath(item: 0, section: section)
let sectionsMinimumInteritemSpacing = resolveMinimumInteritemSpacing(forSectionAt: section)
let sectionsMinimumLineSpacing = resolveMinimumLineSpacing(forSectionAt: section)
let numberOfItems = numberOfItemsInSection(section)
let headerSize = resolveSizeForSupplementaryView(ofKind: .header, at: sectionIndexPath)

if headerSize.height > 0 {
Expand Down

0 comments on commit ba906ce

Please sign in to comment.