Timeline views
The FUITimelineCell and FUITimelineMarkerCell are Interface-Builder-designable UITableViewCell controls, used to construct the Timeline View, which presents information or events in chronological order.

The 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.

The FUITimelinePreviewView shows an excerpt of your project’s milestones in a convenient linear visual presentation. By default, each task node is ordered by date and can be classified as open, complete, or end. Timeline Preview augments task management by prioritizing overdue tasks as well as tasks closest to their due date but not yet marked as complete. This implementation aims to present the most pressing issues to the top of your task queue. Timeline Preview is supported across all currently supported Apple iOS devices.

Interface
FUITimelineCell
FUITimelineCellis a selectable cell intended for timelines that require open and complete status that displays timeline details. Selecting the cell changes the card background color to the framework-preferred color:FioriUIColorStyle.line.- It uses a vertical line and
nodeImageViewas a separator. Left of the vertical line is the timeline event stack view that containseventLabelandeventImageView; right of the vertical line is the main stack view that containsheadlineLabelandsubheadlineLabel. - Below the main view is an attribute stack view with
attributeLabelandsubAttributeLabellaid out horizontally. - To the right of the main view is a status view that contains
statusLabel,statusImage,substatusLabel, andsubstatusImagelaid out vertically.
FUITimelineMarkerCell
FUITimelineMarkerCellis a non-selectable cell withselectionStyleset to.nonethat is intended for timelines with start, inactive, early end, and end status that displays timeline information.- It uses a vertical line and a node image as a separator. Left of the vertical line is the timeline event section that contains
eventLabelandeventImageView; right of the vertical line istitleLabel. - The vertical line contains
leadingTimelineon the top,nodeImageViewin the middle, and atrailingTimelineat the bottom.
Usage
A FUITimelineCell can be used freely within any UITableView:
Register the FUITimelineCell and FUITimelineMarkerCell controls in the viewDidLoad function:
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(FUITimelineCell.self, forCellReuseIdentifier: FUITimelineCell.reuseIdentifier)
tableView.register(FUITimelineMarkerCell.self, forCellReuseIdentifier: FUITimelineMarkerCell.reuseIdentifier)
// ...
}
Initialize and configure cells in tableView(_:cellForRowAt:):
Though both options are marked public, you should always use the
Text: String and Image: UIImageproperties to set cell content, instead of directly setting values to the @IBOutlet. This allows the implementation to optimize the constraints for the given content. It is fine to set other properties of the @IBOutlet, such as font style or color, opacity, etc.
- For
FUITimelineCell:
let cell = tableView.dequeueReusableCell(withIdentifier: FUITimelineCell.reuseIdentifier, for: indexPath) as! FUITimelineCell
cell.headlineText = "Planned Downtime Period Identified"
cell.subheadlineText = "Work Package"
cell.nodeImage = FUITimelineNode.open
cell.eventText = "9:45\nAM"
cell.eventImage = #imageLiteral(resourceName: "rain")
cell.statusImage = #imageLiteral(resourceName: "ErrorIcon")
cell.subStatusText = "Active"
return cell
let cell = tableView.dequeueReusableCell(withIdentifier: FUITimelineMarkerCell.reuseIdentifier, for: indexPath) as! FUITimelineMarkerCell
cell.titleText = "Project Start"
cell.nodeImage = FUITimelineNode.start
cell.eventText = "12/6/15"
cell.showLeadingTimeline = false
return cell
//Your data model
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 dataSource method
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 = {
print("header is selected")
}
cell.timelinePreviewView.addItems(data)
cell.timelinePreviewView.numberOfColumns = 4 //set numberOfColumns if you want to change number of columns showing
return cell
}
-
FUITimelineCellis aUITableViewCellsubclass designed to present a business object related to an event in a Timeline view.
FUITimelineCellis a selectable cell intended for timelines that require open and complete status that displays timeline details. Selecting the cell changes the card background color to the framework-preferred color.- It uses a vertical line and
nodeImageViewas a separator. To the left of the vertical line is the timeline event stack view that containseventLabelandeventImageView. To the right of the vertical line is the main stack view that containsheadlineLabelandsubheadlineLabel. - Below the main view is an attribute stack view with
attributeLabelandsubAttributeLabellaid out horizontally. - To the right of the main view is a status view that contains
statusLabel,statusImage,substatusLabel, andsubstatusImagelaid out vertically.
## Usage
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "FUITimelineCell", for: indexPath) as! FUITimelineCell cell.headlineText = "Planned Downtime Period Identified" cell.subheadlineText = "Work Package" cell.nodeType = .open cell.eventText = "9:45\nAM" cell.eventImage = #imageLiteral(resourceName: "rain") cell.statusImage = #imageLiteral(resourceName: "ErrorIcon") cell.subStatusText = "Active" return cell }## Notes
###
SingleLineSeparator Between Timeline Items in the TableTableview‘s defaultseparatorStyleis.singleLine. Because of this default setting, there can be a 1.0 px divider line or a separator in between each item on the timeline in the table. This is not an issue in timeline. To get rid of the separator, setseparatorStyletononein theTabelViewControllerclass.override func viewDidLoad() { super.viewDidLoad() //... self.tableView.separatorStyle = .none //... }### Customize the Background Color
Developers may use the
backgroundColorproperty oftimelineBackgroundandcardBackgroundto set the background color, and use thesetTintColor(_:_:)UITableViewCellAPI to customize the card background in highlighted and completed states.timelineCell.timelineBackground.backgroundColor = UIColor.orange timelineCell.cardBackground.backgroundColor = UIColor.yellow // For normal background timelineCell.setTintColor(UIColor.red, for: .highlighted) // For highlighted state background timelineCell.setTintColor(UIColor.green, for: .application) // For completed state background## Theming Supported style classes
See morefdlFUITimelineCell fdlFUITimelineCell_headlineLabel fdlFUITimelineCell_subheadlineLabel fdlFUITimelineCell_timestampLabel fdlFUITimelineCell_secondaryTimestampLabel fdlFUITimelineCell_statusLabel fdlFUITimelineCell_substatusLabel fdlFUITimelineCell_attributeLabel fdlFUITimelineCell_subattributeLabel fdlFUITimelineCell_nodeImageView fdlFUITimelineCell_timelineBackground fdlFUITimelineCell_cardBackground fdlFUITimelineCell_cardBackground_past fdlFUITimelineCell_cardBackground_highlightedDeclaration
Swift
@IBDesignable @MainActor open class FUITimelineCell : NibDesignableFUIBaseTableViewCell, FUIStyleSheetAttributesApplying -
FUITimelineMarkerCellis aUITableViewCellsubclass, designed to present a business object related to an event, in a Timeline view.
FUITimelineMarkerCellis a non-selectable withselectionStyleset to.nonethat is intended for timelines with start, inactive, early end, and end status that display timeline information.- It uses a vertical line and a node image as a separator. Left to the vertical line is the timeline event section that contains
eventLabelandeventImageView; right to the vertical line istitleLabel. - The vertical line contains
leadingTimelineon the top,nodeImageViewin the middle, and atrailingTimelineat the bottom.
## Usage
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "FUITimelineMarkerCell", for: indexPath) as! FUITimelineMarkerCell cell.titleText = "Project Start" cell.nodeType = .start cell.eventText = "12/6/15" cell.showLeadingTimeline = false return cell }## Notes ###
SingleLineSeparator Between Timeline Items in the Table The default table viewseparatorStyleis.singleLine. Because of this default setting, there can be a 1.0 px divider line or a separator in-between each item on the timeline in the table. This is not an issue in timeline. To get rid of the separator, setseparatorStyletononein theTabelViewControllerclassoverride func viewDidLoad() { super.viewDidLoad() // ... self.tableView.separatorStyle = .none // ... }## Theming Supported style classes
See morefdlFUITimelineMarkerCell fdlFUITimelineMarkerCell_titleLabel fdlFUITimelineMarkerCell_eventLabel fdlFUITimelineMarkerCell_eventImageView fdlFUITimelineMarkerCell_nodeImageView fdlFUITimelineMarkerCell_cardBackground fdlFUITimelineMarkerCell_timelineBackgroundDeclaration
Swift
@MainActor open class FUITimelineMarkerCell : NibDesignableFUIBaseTableViewCell, FUIStyleSheetAttributesApplying -
FUITimelinePreviewViewis an Interface-Builder-designable UI component that extendsUIViewfor showing a collection of tasks. It comes with a header and a collection view which usesFUITimelineCollectionViewCellto represent data items within it.Using
addItems()to populate a collection ofFUITimelineItemobject.Views Available in
FUIObjectCell:header: aFUICollectionSectionHeaderFooterViewcontaining a title label, an attribute label and a disclosure indicator.collectionView: a collection view displaying a collection of data items represented byFUITimelineCollectionViewCell.
Rules for displaying tasks:
Timeline shows all items due but not marked complete. If there are Overdue objects, this will be shown first until it is marked complete. ‘Today’ will come in the timeline preview only if there is something due ‘Today’.
When the last object is the only one left on the timeline, the Project end date will be visible as the last milestone. The gradient for the horizontal line will switch to right to left.
Once the end of the timeline is visible and due and overdue tasks do not fill all the columns, the completed tasks will start to fill the available columns.
If there is an object due on the last day of the project, it will show as the Open Node, until it is marked complete. Then it will switch to the ‘Complete Node.’ The gradient for the horizontal line will switch to right to left.
Example Initialization and Configuration:
let timelinePreviewView = FUITimelinePreviewView() timelinePreviewView.header.titleLabel.text = "Timeline" timelinePreviewView.header.attributeLabel.text = "attribute" timelinePreviewView.header.isDisclosureAccessoryHidden = false timelinePreviewView.header.didSelectHandler = { // do something when disclosure indicator is tapped } let item0 = FUITimelineItem() item0.title = "Planned Downtime Period Identified for Tasks" item0.due = Date(timeIntervalSinceNow: -86400 * 2) item0.status = .complete let item1 = FUITimelineItem() item1.title = "UX Design Review" item1.due = Date(timeIntervalSinceNow: -86400) item1.status = .open timelinePreviewView.addItems([item0, item1])theming
See morefdlFUITimelinePreviewView_header { font-style: subheadline; font-color: @primary2; }Declaration
Swift
@IBDesignable @MainActor open class FUITimelinePreviewView : UIView, UICollectionViewDataSource -
FUITimelinePreviewTableViewCellis an Interface-Builder-designable UI component that extendsNibDesignableTableViewCellwhich contains aFUITimelinePreviewView. It resizes itself to fit content using the auto-layout size ofFUITimelinePreviewView.Views Available in
FUIObjectTableViewCell:timelinePreviewView: anFUITimelinePreviewViewobject 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
See morefdlFUITimelinePreviewTableViewCell { background-color: @clear; } fdlFUITimelinePreviewTableViewCell_selected { background-color: @line; }Declaration
Swift
@IBDesignable @MainActor open class FUITimelinePreviewTableViewCell : NibDesignableFUIBaseTableViewCell -
FUITimelineItem is an item specialized for placement in FUITimelinePreviewView.
See moreDeclaration
Swift
open class FUITimelineItem : NSObject -
FUITimelinePreviewNodeis a variant ofFUITimelineNodewhich defines framework-supplied images for various timeline node status values in FUITimelineCollectionViewCell.Usage
let nodeImage = FUITimelinePreviewNode.open or let nodeImage = FUITimelinePreviewNode.generateOpenImage(useTintColor: useTintColor)Theming
Supported style classes:
See morefdlFUITimelinePreviewNode fdlFUITimelinePreviewNode_start_icon fdlFUITimelinePreviewNode_open_icon fdlFUITimelinePreviewNode_inProgress_icon fdlFUITimelinePreviewNode_complete_icon fdlFUITimelinePreviewNode_end_iconDeclaration
Swift
public struct FUITimelinePreviewNode -
The status of FUITimelineItem.
See moreDeclaration
Swift
public enum FUITimelineStatus : Int -
FUITimelineCollectionViewCellis an Interface-Builder-designable UI component that extendsNibDesignableCollectionViewCellfor showing information of a task.FUITimelinePreviewViewembeds a collection view which displays a set ofFUITimelineCollectionViewCell.Views Available in
FUITimelineCollectionViewCell:titleLabel: anUILabelshowing a short description of the task.footnoteLabel: anUILabelshowing extra information about the task. When cell is used with aFUITimelinePreviewView, the textual representation of due date ofFUITimelineItemis put here.nodeImageView: anUIImageViewcontains a node image showing the status of the task. You change the node type by setting ‘nodeType’ onFUITimelineCollectionViewCell.
Example Initialization and Configuration:
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUITimelineCollectionViewCell.reuseIdentifier, for: indexPath) as! FUITimelineCollectionViewCell cell.title = "Development Kick-off" cell.footnote = Date() cell.nodeType = .open return cell }theming
See morefdlFUITimelineCollectionViewCell_titleLabel { font-style: subheadline; font-color: primary1; } fdlFUITimelineCollectionViewCell_footnoteLabel { font-style: footnote; font-color: primary3; }Declaration
Swift
@IBDesignable @MainActor open class FUITimelineCollectionViewCell : NibDesignableCollectionViewCell -
The
See moreFUITimelineCollectionViewHorizontalFlowLayoutis a subclass ofFUIStandardAutoSizingColumnFlowLayoutwhich resizes collection view cell items, to lay them out according to a specified number of columns. All items on the same row are resized to have identical cell height using the height of the tallest cell in that row.Declaration
Swift
@MainActor open class FUITimelineCollectionViewHorizontalFlowLayout : FUIStandardAutoSizingColumnFlowLayout