Skip to content

Timeline Preview Table View Cell

FUITimelinePreviewTableViewCell

open class FUITimelinePreviewTableViewCell: NibDesignableFUIBaseTableViewCell

FUITimelinePreviewTableViewCell is an Interface-Builder-designable UI component that extends NibDesignableTableViewCell which contains a FUITimelinePreviewView. It resizes itself to fit content using the auto-layout size of FUITimelinePreviewView.

Views Available in FUIObjectTableViewCell

  • timelinePreviewView: an FUITimelinePreviewView object contains a header and a collection view.

Example Initialization and Configuration

var data: [FUITimelineItem] {
let item0 = FUITimelineItem()
item0.title = "Planned Downtime Period Identified for Tasks"
item0.due = Date(timeIntervalSinceNow: -86400 * 2) // 86400 sec equal to 1 day
item0.status = .complete

let item1 = FUITimelineItem()
item1.title = "UX Design Review"
item1.due = Date(timeIntervalSinceNow: -86400)
item1.status = .open

let item2 = FUITimelineItem()
item2.title = "Planned Downtime Period Identified for Tasks"
item2.due = Date()
item2.status = .open

let item3 = FUITimelineItem()
item3.title = "UX Design Review"
item3.due = Date(timeIntervalSinceNow: 86400)
item3.status = .open

let item4 = FUITimelineItem()
item4.title = "Project End"
item4.due = Date(timeIntervalSinceNow: 86400 * 2.0)
item4.status = .end

return [item0, item1, item2, item3, item4]
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUITimelinePreviewTableViewCell.reuseIdentifier, for: indexPath) as! FUITimelinePreviewTableViewCell

cell.timelinePreviewView.header.titleLabel.text = "Timeline"
cell.timelinePreviewView.header.attributeLabel.text = "attribute"
cell.timelinePreviewView.header.isDisclosureAccessoryHidden = false
cell.timelinePreviewView.header.didSelectHandler = {
}

// If you want to display other styles than date, for example, Time.
let formatter = DateFormatter()
formatter.dateFormat = "hh:mm"
cell.timelinePreviewView.dateFormatter = formatter

cell.timelinePreviewView.addItems(data)

return cell
}

Theming

fdlFUITimelinePreviewTableViewCell {
background-color: @clear;
}
fdlFUITimelinePreviewTableViewCell_selected {
background-color: @line;
}

Last update: April 14, 2021