mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-20 06:30:31 +01:00
Fix some build errors.
This commit is contained in:
parent
b048e3fd58
commit
69718e2dde
@ -6,9 +6,9 @@
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
final class TimelineTableViewDataSource {
|
||||
@objc final class TimelineTableViewDataSource: NSObject, NSTableViewDataSource {
|
||||
|
||||
private weak var timelineViewController: TimelineViewController?
|
||||
|
||||
@ -21,12 +21,12 @@ final class TimelineTableViewDataSource {
|
||||
|
||||
func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
|
||||
return timelineViewController?.articles.count ? 0
|
||||
return timelineViewController?.numberOfArticles ?? 0
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
||||
|
||||
return timelineViewController?.articleAtRow(row) ? nil
|
||||
return timelineViewController?.articleAtRow(row) ?? nil
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
}
|
||||
var cellAppearance: TimelineCellAppearance!
|
||||
|
||||
var numberOfArticles: Int {
|
||||
get {
|
||||
return articles.count
|
||||
}
|
||||
}
|
||||
|
||||
private var articles = [Article]() {
|
||||
didSet {
|
||||
if articles != oldValue {
|
||||
@ -239,16 +245,16 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
return nil
|
||||
}
|
||||
|
||||
var ix = tableView.selectedRow
|
||||
var rowIndex = tableView.selectedRow
|
||||
while(true) {
|
||||
|
||||
ix = ix + 1
|
||||
if ix >= articles.count {
|
||||
rowIndex = rowIndex + 1
|
||||
if rowIndex >= articles.count {
|
||||
break
|
||||
}
|
||||
let article = articleAtRow(ix)!
|
||||
let article = articleAtRow(rowIndex)!
|
||||
if !article.status.read {
|
||||
return ix
|
||||
return rowIndex
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,7 +395,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
})
|
||||
}
|
||||
|
||||
private func articleAtRow(_ row: Int) -> Article? {
|
||||
func articleAtRow(_ row: Int) -> Article? {
|
||||
|
||||
if row < 0 || row == NSNotFound || row > articles.count - 1 {
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user