-
Notifications
You must be signed in to change notification settings - Fork 28
Description
UITableViewCells have a function built in: setHighlighted(_ highlighted: Bool, animated: Bool)`, which allows you to manipulate any subviews as needed when the user touches down on a cell.
With FunctionalTableData, this callback does not occur for free. There's currently no way in a HostCell implementation to override this callback.
The most common use case is when you have a UIView or UIImageView with an opaque background color. On highlight, UITableViewCell will automatically remove the background color for any subviews to ensure the selection color is visible. In the cases where you want to retain the background color of any subviews during selection and highlighting with a UITableViewCell you'd simply override setHighlighted and ensure the background is set for either state.
CellActions currently provides some state overriding, such as SelectionState, however none exist for a highlighted state.
I reckon something like the following would be good:
public typealias HighlightingAction = (_ sender: UIView, highlighted: Bool) -> HighlightingStatewith
public enum HighlightingState {
case highlighted
case unhighlighted
}At the same time, I do see two callbacks for selection/deselection, so highlighting could have the same two, or perhaps selection could be reconfigured to one callback to have the two be the same:
public typealias SelectionAction = (_ sender: UIView, selected: Bool) -> SelectionState