Move the timeline table’s data source a separate file/class.

This commit is contained in:
Brent Simmons
2017-10-30 08:23:01 -07:00
parent 82c75a56d3
commit b048e3fd58
4 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
//
// TimelineTableViewDataSource.swift
// Evergreen
//
// Created by Brent Simmons on 10/29/17.
// Copyright © 2017 Ranchero Software. All rights reserved.
//
import Foundation
final class TimelineTableViewDataSource {
private weak var timelineViewController: TimelineViewController?
init(timelineViewController: TimelineViewController) {
self.timelineViewController = timelineViewController
}
// MARK: NSTableViewDataSource
func numberOfRows(in tableView: NSTableView) -> Int {
return timelineViewController?.articles.count ? 0
}
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return timelineViewController?.articleAtRow(row) ? nil
}
}