diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UICollectionView.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UICollectionView.swift index bcb38a1..8636470 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UICollectionView.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UICollectionView.swift @@ -140,4 +140,15 @@ public extension FlexUI where Component: UICollectionView { component.isPagingEnabled = isPagingEnabled return self } + + /// Sets the refresh control associated with the scroll view. + /// + /// - Parameter refreshControl: The refresh control associated with the scroll view. + /// - Returns: The current instance of `FlexUI` for further configuration. + @discardableResult + @MainActor + func refreshControl(_ refreshControl: UIRefreshControl) -> Self { + component.refreshControl = refreshControl + return self + } } diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UITableView.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UITableView.swift new file mode 100644 index 0000000..5bfbe24 --- /dev/null +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UITableView.swift @@ -0,0 +1,33 @@ +// +// flex-ui +// Copyright © 2026 Space Code. All rights reserved. +// + +import UIKit + +/// An extension to `FlexUI` that adds helper methods for configuring `UITableView` properties. +/// These methods allow for fluent configuration of properties such as scroll indicators, selection, +/// and registration of cells and headers. +public extension FlexUI where Component: UITableView { + /// Sets the delegate for the table view. + /// + /// - Parameter delegate: The delegate object that conforms to `UITableViewDelegate`. + /// - Returns: The current instance of `FlexUI` for further configuration. + @discardableResult + @MainActor + func delegate(_ delegate: UITableViewDelegate?) -> Self { + component.delegate = delegate + return self + } + + /// Sets the data source for the table view. + /// + /// - Parameter dataSource: The data source object that conforms to `UITableViewDataSource`. + /// - Returns: The current instance of `FlexUI` for further configuration. + @discardableResult + @MainActor + func dataSource(_ dataSource: UITableViewDataSource?) -> Self { + component.dataSource = dataSource + return self + } +}