SwiftGridView
@MainActor
open class SwiftGridView : UIView, UICollectionViewDataSource, UICollectionViewDelegate, SwiftGridLayoutDelegate, SwiftGridReusableViewDelegate
SwiftGridView
is the primary view class, utilizing a UICollectionView and a custom layout handler.
-
Undocumented
Declaration
Swift
@MainActor public required init?(coder aDecoder: NSCoder)
-
Undocumented
Declaration
Swift
@MainActor public override init(frame: CGRect)
-
Internal Collectionview. Open to allow for custom interaction, modify at own risk.
Declaration
Swift
@objc @MainActor open internal(set) var collectionView: UICollectionView! { get }
-
Allows IBOutlets to work properly. Required dataSource link of type
SwiftGridViewDataSource
-
Allows IBOutlets to work properly. Required delegate link of type
SwiftGridViewDelegate
-
Required dataSource link of type
SwiftGridViewDataSource
Declaration
Swift
@objc @MainActor open weak var dataSource: SwiftGridViewDataSource?
-
Required delegate link of type
SwiftGridViewDelegate
Declaration
Swift
@objc @MainActor open weak var delegate: SwiftGridViewDelegate?
-
Enable or disable selection for the entire gridview.
Declaration
Swift
@objc @MainActor open var allowsSelection: Bool { get set }
-
When enabled, multiple cells can be selected. If row selection is enabled, then multiple rows can be selected.
Declaration
Swift
@objc @MainActor open var allowsMultipleSelection: Bool
-
If row selection is enabled, then entire rows will be selected rather than individual cells. This applies to section headers/footers in addition to rows.
Declaration
Swift
@objc @MainActor open var rowSelectionEnabled: Bool
-
Array of
SwiftGridCell
for all visible cells.Declaration
Swift
@objc @MainActor open var visibleCells: [SwiftGridCell] { get }
-
Array of
IndexPath
for all visible cells.Declaration
Swift
@objc @MainActor open var indexPathsForVisibleItems: [IndexPath] { get }
-
Array of
IndexPath
for any selected cellsDeclaration
Swift
@objc @MainActor open var indexPathsForSelectedItems: [IndexPath] { get }
-
When directional lock is enabled, the grid is only scrollable in one direction at a time (vertically or horizontally)
Declaration
Swift
@objc @MainActor open var isDirectionalLockEnabled: Bool { get set }
-
Enables bouncing for the gridvies
Declaration
Swift
@objc @MainActor open var bounces: Bool { get set }
-
Determines whether section headers will stick while scrolling vertically or scroll off screen.
Declaration
Swift
@objc @MainActor open var stickySectionHeaders: Bool { get set }
-
default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically
Declaration
Swift
@objc @MainActor open var alwaysBounceVertical: Bool { get set }
-
default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag horizontally
Declaration
Swift
@objc @MainActor open var alwaysBounceHorizontal: Bool { get set }
-
A Boolean value that controls whether the horizontal scroll indicator is visible. The default value is true. The indicator is visible while tracking is underway and fades out after tracking.
Declaration
Swift
@objc @MainActor open var showsHorizontalScrollIndicator: Bool { get set }
-
A Boolean value that controls whether the vertical scroll indicator is visible. The default value is true. The indicator is visible while tracking is underway and fades out after tracking.
Declaration
Swift
@objc @MainActor open var showsVerticalScrollIndicator: Bool { get set }
-
Pinch to expand increases the size of the columns. Experimental feature.
Declaration
Swift
@objc @MainActor open var pinchExpandEnabled: Bool { get set }
-
Declaration
Swift
@objc @MainActor open var isTracking: Bool { get }
Return Value
YES if user has touched. may not yet have started draggin
-
Declaration
Swift
@objc @MainActor open var isDragging: Bool { get }
Return Value
YES if user has started scrolling. this may require some time and or distance to move to initiate dragging
-
Declaration
Swift
@objc @MainActor open var isDecelerating: Bool { get }
Return Value
YES if user isn’t dragging (touch up) but scroll view is still moving
-
Whether or not the gridView will automatically scroll to top when the status bar is tapped. Default is YES.
Declaration
Swift
@objc @MainActor open var scrollsToTop: Bool { get set }
-
Undocumented
Declaration
Swift
@objc @MainActor open var refreshControl: UIRefreshControl? { get set }
-
Undocumented
Declaration
Swift
@MainActor open override func layoutSubviews()
-
Reloads all data for the
SwiftGridView
Declaration
Swift
@objc @MainActor open func reloadData(_ resetSize: Bool = true)
-
Reloads the specified items by their indexPath(s).
Declaration
Swift
@objc @MainActor open func reloadCellsAtIndexPaths(_ indexPaths: [IndexPath], animated: Bool)
Parameters
indexPaths
Array of
IndexPath
to reloadanimated
Whether to animate the change or not
-
Reloads the specified items by their indexPath(s).
Declaration
Swift
@objc @MainActor open func reloadCellsAtIndexPaths(_ indexPaths: [IndexPath], animated: Bool, completion: ((Bool) -> Void)?)
Parameters
indexPaths
Array of
IndexPath
to reloadanimated
Whether to animate the change or not
completion
Completion handler executed upon reload
-
Get the item indexPath based on the provided point
Declaration
Swift
@objc @MainActor open func indexPathForItem(at point: CGPoint) -> IndexPath?
Parameters
point
CGPoint
to search forReturn Value
The indexPath for the appropriate item if it exists
-
Get the item indexPath for the provided cell
Declaration
Swift
@objc @MainActor open func indexPath(for cell: SwiftGridCell) -> IndexPath?
Parameters
cell
Instance of
SwiftGridCell
Return Value
The indexPath for the appropriate item if it exists
-
Get the selected indexPath(s) for the provided supplementary view kind
Declaration
Swift
@objc @MainActor open func selectedIndexPathsForSupplementaryView(ofElementKind kind: String) -> [IndexPath]
Parameters
kind
View type
SwiftGridViewElementKind...
Return Value
Array of
IndexPath
for the selected view(s) -
Get the cell for the provided indexPath
Declaration
Swift
@objc @MainActor open func cellForItem(at indexPath: IndexPath) -> SwiftGridCell?
Parameters
indexPath
IndexPath to search for.
Return Value
The
SwiftGridCell
instance for the provided indexPath -
Get the supplementary view for the provided indexPath
Declaration
Swift
@objc @MainActor open func supplementaryView(ofElementKind kind: String, at indexPath: IndexPath) -> SwiftGridReusableView?
Parameters
kind
View type
SwiftGridViewElementKind...
indexPath
IndexPath to search for.
Return Value
The
SwiftGridReusableView
instance for the provided indexPath -
Register the provided class for row cell reuse within the
SwiftGridView
Declaration
Swift
@objc(registerClass:forCellReuseIdentifier:) @MainActor open func register(_ cellClass: Swift.AnyClass?, forCellWithReuseIdentifier identifier: String)
-
Register the provided nib for row cell reuse within the
SwiftGridView
Declaration
Swift
@objc @MainActor open func register(_ nib: UINib?, forCellWithReuseIdentifier identifier: String)
-
Register the provided class for supplementary cell reuse within the
SwiftGridView
Declaration
Swift
@objc(registerClass:forSupplementaryViewOfKind:withReuseIdentifier:) @MainActor open func register(_ viewClass: Swift.AnyClass?, forSupplementaryViewOfKind elementKind: String, withReuseIdentifier identifier: String)
-
Register the provided class for supplementary cell reuse within the
SwiftGridView
Declaration
Swift
@objc @MainActor open func register(_ nib: UINib?, forSupplementaryViewOfKind kind: String, withReuseIdentifier identifier: String)
-
Dequeue Row Cell
Declaration
Swift
@objc @MainActor open func dequeueReusableCellWithReuseIdentifier(_ identifier: String, forIndexPath indexPath: IndexPath!) -> SwiftGridCell
-
Dequeue Supplementary Cell by column
Declaration
Swift
@objc @MainActor open func dequeueReusableSupplementaryViewOfKind(_ elementKind: String, withReuseIdentifier identifier: String, atColumn column: NSInteger) -> SwiftGridReusableView
-
Dequeue Supplementary Cell by
IndexPath
Declaration
Swift
@objc @MainActor open func dequeueReusableSupplementaryViewOfKind(_ elementKind: String, withReuseIdentifier identifier: String, forIndexPath indexPath: IndexPath) -> SwiftGridReusableView
-
Selects the cell at the provided indexPath
Declaration
Swift
@objc @MainActor open func selectCellAtIndexPath(_ indexPath: IndexPath, animated: Bool)
-
Deselects the cell at the provided indexPath
Declaration
Swift
@objc @MainActor open func deselectCellAtIndexPath(_ indexPath: IndexPath, animated: Bool)
-
Selects the header at the provided indexPath
Declaration
Swift
@objc @MainActor open func selectHeaderAtIndexPath(_ indexPath: IndexPath)
-
Deselects the header at the provided indexPath
Declaration
Swift
@objc @MainActor open func deselectHeaderAtIndexPath(_ indexPath: IndexPath)
-
Select the section header at the provided indexPath
Declaration
Swift
@objc @MainActor open func selectSectionHeaderAtIndexPath(_ indexPath: IndexPath)
-
Deselect the section header at the provided indexPath
Declaration
Swift
@objc @MainActor open func deselectSectionHeaderAtIndexPath(_ indexPath: IndexPath)
-
Select the section footer at the provided indexPath
Declaration
Swift
@objc @MainActor open func selectSectionFooterAtIndexPath(_ indexPath: IndexPath)
-
Deselect the section footer at the provided indexPath
Declaration
Swift
@objc @MainActor open func deselectSectionFooterAtIndexPath(_ indexPath: IndexPath)
-
Scroll to the cell at the provided indexPath. If the cell scroll posiition would not fit without pushing the grid outside of its normal scroll bounds, the position wil be the closest compatible
Declaration
Swift
@objc @MainActor open func scrollToCellAtIndexPath(_ indexPath: IndexPath, atScrollPosition scrollPosition: UICollectionView.ScrollPosition, animated: Bool)
Parameters
indexPath
IndexPath of the cell to scroll to
scrollPosition
Position to use when scrolling.
animated
Whether to animate the scroll action
-
Manually set the content offset for the gridview
Declaration
Swift
@objc @MainActor open func setContentOffset(_ contentOffset: CGPoint, animated: Bool)
-
Declaration
Swift
@objc @MainActor open func location(for gestureRecognizer: UIGestureRecognizer) -> CGPoint
Return Value
The
CGPoint
location for the provided gesture in the gridview context
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func swiftGridReusableView(_ reusableView: SwiftGridReusableView, didSelectViewAtIndexPath indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func swiftGridReusableView(_ reusableView: SwiftGridReusableView, didDeselectViewAtIndexPath indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func swiftGridReusableView(_ reusableView: SwiftGridReusableView, didHighlightViewAtIndexPath indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func swiftGridReusableView(_ reusableView: SwiftGridReusableView, didUnhighlightViewAtIndexPath indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func numberOfSections(in collectionView: UICollectionView) -> Int
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView
-
Undocumented
Declaration
Swift
@MainActor open func selectColumnAtIndexPath(_ indexPath: IndexPath, animated: Bool, includeHeader: Bool = true)
-
Undocumented
Declaration
Swift
@MainActor open func deselectColumnAtIndexPath(_ indexPath: IndexPath, animated: Bool, includeHeader: Bool = true)
-
Undocumented
Declaration
Swift
@MainActor open func selectRowAtIndexPath(_ indexPath: IndexPath, animated: Bool)
-
Undocumented
Declaration
Swift
@MainActor open func deselectRowAtIndexPath(_ indexPath: IndexPath, animated: Bool)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
-
Internal to SwiftGridView, do not use
Declaration
Swift
@MainActor open func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath)