IPCardListView

public class IPCardListView : UIView
extension IPCardListView: UITableViewDelegate, UITableViewDataSource

View to be used to display a collection of cards

Prepare dataset:

let items = [
    IPCardItem(barColor: .systemRed, cardTitle: nil, dueDate: nextMonthDate, isPaid: false, type: .netflix, amount: 100.0, isLocked: false),
    IPCardItem(barColor: UIColor.from(hex: "#0d56f3"), cardTitle: nil, dueDate: Date(), isPaid: true,  type: .nubank, amount: 150.0, isLocked: false),
    IPCardItem(barColor: .systemGreen, cardTitle: nil, dueDate:Date(), isPaid: false, type: .spotify, amount: 400, isLocked: false),
    IPCardItem(barColor: .systemRed, cardTitle: nil, dueDate:Date(), isPaid: false, type: .lightbill(flag: .red), amount: 400, isLocked: false),
    IPCardItem(barColor: .lightGray, cardTitle: "ARNALDO PESSOA LEAL", dueDate: Date(), type: .standard(imageUrl: "https://devshift.biz/wp-content/uploads/2017/04/profile-icon-png-898.png"), amount: 100.0, isLocked: false),
    IPCardItem(barColor: UIColor.from(hex: "#0d56f3"), cardTitle: nil, dueDate: Date(), isPaid: true, type: .standard(imageUrl: "https://logodownload.org/wp-content/uploads/2014/04/bmw-logo-2.png"), amount: 100.0, isLocked: true)
]

let text = "Você tem 4 pagamentos vencendo em até <b>7 dias</b>, no valor total de: ".convertHtml(textColor: .white)

Usage by programatically init:

let cardListView = IPCardListView(source: items,
                                   featured: true,
                                   featuredColor: .systemOrange,
                                   featuredTextColor: .white,
                                   titleText: "Vencendo em até 7 dias",
                                   totalPaymentText: text,
                                   totalAlignment: .center,
                                   totalDueOnly: true)

Alternative to init configuration:


cardListView.configure(source: items,
                        featured: true,
                        featuredColor: .systemOrange,
                        featuredTextColor: .white,
                        titleText: "Vencendo em até 7 dias",
                        totalPaymentText: text,
                        totalAlignment: .center,
                        totalDueOnly: true)

Notes:

  1. It can be inherited on .xibs/.storyboards or initialized with the configuration values

Public variables

Initializers

Lifecycle methods

  • Undocumented

    Declaration

    Swift

    public override func layoutSubviews()

Public methods

  • Set settings for the component the given parameters.

    Declaration

    Swift

    public func configure(source: [IPCardItem],
                          featured: Bool = false,
                          featuredColor: UIColor = .clear,
                          featuredTextColor: UIColor = .darkText,
                          titleText: String? = nil,
                          totalPaymentText: NSAttributedString = NSAttributedString(string:""),
                          totalAlignment: NSTextAlignment = .center,
                          totalDueOnly: Bool = false)

    Parameters

    source

    List of cards to fill the component.

    featured

    Flag to set as spotlight

    featuredColor

    Spotlight color.

    featuredTextColor

    Color of bottom text (Default: .darkText)..

    featuredPaymentText

    Text to describe the total amount displayed at the bottom of the view..

    totalAlignment

    Alignment for the featuredPaymentText..

    totalDueOnly

    set if should be displayed only the total for dueDates..

UITableViewDelegate and DataSource

  • Undocumented

    Declaration

    Swift

    public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
  • Undocumented

    Declaration

    Swift

    public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
  • Undocumented

    Declaration

    Swift

    public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)