Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #26 from apptekstudios/dev
Browse files Browse the repository at this point in the history
Remove ASCollectionLayoutFlow in favour of UICollectionViewFlowLayout
  • Loading branch information
apptekstudios authored Oct 22, 2019
2 parents 732b02d + 31eddce commit 16657fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Demo/ASCollectionViewDemo/Screens/Tags/TagsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ struct TagsScreen: View {
.font(.title)
ASCollectionView(
data: store.items,
layout: .init(layout: {
layout: ASCollectionViewLayout(customLayout: {
let fl = AlignedFlowLayout()
fl.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
return fl
}())
})
) { item in
Text(item.displayString)
.fixedSize()
Expand Down
10 changes: 6 additions & 4 deletions Sources/ASCollectionView/ASCollectionViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public struct ASCollectionViewLayout<SectionID: Hashable>
self.layout = .compositional({ _ in layout }, interSectionSpacing: interSectionSpacing, scrollDirection: scrollDirection) // ignore section ID -> all have same layout
}

public init(layout: UICollectionViewLayout)
public init(customLayout: (() -> UICollectionViewLayout))
{
self.layout = .custom(layout)
self.layout = .custom(customLayout())
}

public func makeLayout(withCoordinator coordinator: ASCollectionView<SectionID>.Coordinator) -> UICollectionViewLayout
Expand Down Expand Up @@ -134,7 +134,9 @@ public struct ASCollectionViewLayoutList: ASCollectionViewLayoutSection
return section
}
}

/*
//It is recommended to use UICollectionViewFlowLayout instead (see demo project). The new CompositionalLayout doesn't yet handle flow layouts well.
public struct ASCollectionViewLayoutFlow: ASCollectionViewLayoutSection
{
var itemSpacing: CGFloat
Expand Down Expand Up @@ -192,7 +194,7 @@ public struct ASCollectionViewLayoutFlow: ASCollectionViewLayoutSection
return section
}
}

*/
public struct ASCollectionViewLayoutGrid: ASCollectionViewLayoutSection
{
var layoutMode: LayoutMode
Expand Down

0 comments on commit 16657fa

Please sign in to comment.