mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 09:11:13 +01:00
33 lines
747 B
Swift
33 lines
747 B
Swift
|
//
|
||
|
// TimelineDataSource.swift
|
||
|
// Evergreen
|
||
|
//
|
||
|
// Created by Brent Simmons on 2/17/18.
|
||
|
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import AppKit
|
||
|
|
||
|
@objc final class TimelineDataSource: NSObject, NSTableViewDataSource {
|
||
|
|
||
|
var articles = ArticleArray()
|
||
|
|
||
|
func numberOfRows(in tableView: NSTableView) -> Int {
|
||
|
|
||
|
return articles.count
|
||
|
}
|
||
|
|
||
|
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
||
|
|
||
|
return articles.articleAtRow(row) ?? nil
|
||
|
}
|
||
|
|
||
|
func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? {
|
||
|
|
||
|
guard let article = articles.articleAtRow(row) else {
|
||
|
return nil
|
||
|
}
|
||
|
return ArticlePasteboardWriter(article: article)
|
||
|
}
|
||
|
}
|