NatListItemCell

open class NatListItemCell : UITableViewCell
extension NatListItemCell: Pulsable

NatListItemCell is a class that representes the component List Item from Natura Design System. It inherits from UITableViewCell, being used inside UITableViews.

It has the basic behavior for table cells according to the Design System: - a predefined selected color overlay - a ripple effect on touch - and a bottom divider

NatListItemCell should be used as a base for your custom cell:

    class CustomCell: NatListItemCell {
       // your code for custom cell

        override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
           super.init(style: style, reuseIdentifier: reuseIdentifier)
           // your code for initializing custom cell
           commonInit()
        }
    }

Important

To create a custom cell that inherits from NatListItemCell, you should follow the steps:
  1. Create your custom cell with custom views
  2. Override the function init(style:, reuseIdentifier:)
  3. Call commonInit() inside the override

Otherwise, the cell will not have the expected behavior for a NatListItemCell.

Requires

It’s necessary to configure the Design System with a theme or fatalError will be raised.

   DesignSystem().configure(with: AvailableTheme)

Init

  • Call this method in methods init(style: UITableViewCellStyle, reuseIdentifier: String?) after creating views

    Declaration

    Swift

    @objc
    open func commonInit()
  • Undocumented

    Declaration

    Swift

    open override func awakeFromNib()

Overrides

  • Undocumented

    Declaration

    Swift

    public override func setSelected(_ selected: Bool, animated: Bool)
  • Undocumented

    Declaration

    Swift

    public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
  • Undocumented

    Declaration

    Swift

    public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?)

Public methods

  • Sets if the cell is clicable or not.

    Declaration

    Swift

    public func configure(onClick: Bool)

    Parameters

    onClick

    a bool that indicates if the cell is clicable

  • Sets the feedback style for the cell after the touch.

    Declaration

    Swift

    public func configure(feedbackStyle: FeedbackStyle)

    Parameters

    feedbackStyle

    an option from FeedbackStyle enum

  • Sets the divider style for the cell. By default, the cell doesn’t have a divider To use the divider, you must configure your tableView as tableView.separatorStyle = .none

    Declaration

    Swift

    public func configure(divider: Divider.Styles)

    Parameters

    divider

    an option from divider styles enum

  • Removes the divider from the cell

    Declaration

    Swift

    public func configureRemoveDivider()
  • FeedbackStyle is a enum that represents feedback styles for NatListItemCell component.

    These are all styles allowed:

    • ripple (adds a ripple animation)
    • selection (changes
    See more

    Declaration

    Swift

    public enum FeedbackStyle