Unverified Commit cde0b1e8 authored by Anthony Drendel's avatar Anthony Drendel Committed by GitHub
Browse files

Add background color modifier to ASCollectionView (#1)

parent 4550cd5b
Showing with 11 additions and 0 deletions
+11 -0
......@@ -67,6 +67,14 @@ public extension ASCollectionView
return this
}
/// Sets the collection view's background color
func backgroundColor(_ color: UIColor?) -> Self
{
var this = self
this.backgroundColor = color
return this
}
/// Set whether to show scroll indicators
func scrollIndicatorsEnabled(horizontal: Bool = true, vertical: Bool = true) -> Self
{
......
......@@ -28,6 +28,8 @@ public struct ASCollectionView<SectionID: Hashable>: UIViewControllerRepresentab
internal var onScrollCallback: OnScrollCallback?
internal var onReachedBoundaryCallback: OnReachedBoundaryCallback?
internal var backgroundColor: UIColor?
internal var horizontalScrollIndicatorEnabled: Bool = true
internal var verticalScrollIndicatorEnabled: Bool = true
internal var contentInsets: UIEdgeInsets = .zero
......@@ -184,6 +186,7 @@ public struct ASCollectionView<SectionID: Hashable>: UIViewControllerRepresentab
func updateCollectionViewSettings(_ collectionView: UICollectionView)
{
assignIfChanged(collectionView, \.backgroundColor, newValue: parent.backgroundColor)
assignIfChanged(collectionView, \.dragInteractionEnabled, newValue: true)
assignIfChanged(collectionView, \.alwaysBounceVertical, newValue: parent.alwaysBounceVertical)
assignIfChanged(collectionView, \.alwaysBounceHorizontal, newValue: parent.alwaysBounceHorizontal)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment