Remove extraneous get { from a bunch of read-only accessors.
This commit is contained in:
parent
192439abe7
commit
2f21dbf6be
@ -17,10 +17,8 @@ final class DeleteFromSidebarCommand: UndoableCommand {
|
|||||||
let undoManager: UndoManager
|
let undoManager: UndoManager
|
||||||
let undoActionName: String
|
let undoActionName: String
|
||||||
var redoActionName: String {
|
var redoActionName: String {
|
||||||
get {
|
|
||||||
return undoActionName
|
return undoActionName
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private let itemSpecifiers: [SidebarItemSpecifier]
|
private let itemSpecifiers: [SidebarItemSpecifier]
|
||||||
|
|
||||||
@ -94,7 +92,6 @@ private struct SidebarItemSpecifier {
|
|||||||
private let path: ContainerPath
|
private let path: ContainerPath
|
||||||
|
|
||||||
private var container: Container? {
|
private var container: Container? {
|
||||||
get {
|
|
||||||
if let parentFolder = parentFolder {
|
if let parentFolder = parentFolder {
|
||||||
return parentFolder
|
return parentFolder
|
||||||
}
|
}
|
||||||
@ -103,7 +100,6 @@ private struct SidebarItemSpecifier {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init?(node: Node) {
|
init?(node: Node) {
|
||||||
|
|
||||||
|
@ -42,26 +42,18 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
|
|||||||
extension Article {
|
extension Article {
|
||||||
|
|
||||||
var feed: Feed? {
|
var feed: Feed? {
|
||||||
get {
|
|
||||||
return account?.existingFeed(with: feedID)
|
return account?.existingFeed(with: feedID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var preferredLink: String? {
|
var preferredLink: String? {
|
||||||
get {
|
|
||||||
return url ?? externalURL
|
return url ?? externalURL
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var body: String? {
|
var body: String? {
|
||||||
get {
|
|
||||||
return contentHTML ?? contentText ?? summary
|
return contentHTML ?? contentText ?? summary
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var logicalDatePublished: Date {
|
var logicalDatePublished: Date {
|
||||||
get {
|
|
||||||
return datePublished ?? dateModified ?? status.dateArrived
|
return datePublished ?? dateModified ?? status.dateArrived
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -31,10 +31,8 @@ final class FeedListFeed: Hashable, DisplayNameProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nameForDisplay: String { // DisplayNameProvider
|
var nameForDisplay: String { // DisplayNameProvider
|
||||||
get {
|
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init(name: String, url: String, homePageURL: String) {
|
init(name: String, url: String, homePageURL: String) {
|
||||||
|
|
||||||
|
@ -17,10 +17,8 @@ final class FeedListFolder: Hashable, DisplayNameProvider {
|
|||||||
let hashValue: Int
|
let hashValue: Int
|
||||||
|
|
||||||
var nameForDisplay: String { // DisplayNameProvider
|
var nameForDisplay: String { // DisplayNameProvider
|
||||||
get {
|
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init(name: String, feeds: Set<FeedListFeed>) {
|
init(name: String, feeds: Set<FeedListFeed>) {
|
||||||
|
|
||||||
|
@ -33,10 +33,8 @@ final class InspectorWindowController: NSWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isOpen: Bool {
|
var isOpen: Bool {
|
||||||
get {
|
|
||||||
return isWindowLoaded && window!.isVisible
|
return isWindowLoaded && window!.isVisible
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private var inspectors: [InspectorViewController]!
|
private var inspectors: [InspectorViewController]!
|
||||||
|
|
||||||
|
@ -126,13 +126,11 @@ class AddFeedController: AddFeedWindowControllerDelegate, FeedFinderDelegate {
|
|||||||
private extension AddFeedController {
|
private extension AddFeedController {
|
||||||
|
|
||||||
var urlStringFromPasteboard: String? {
|
var urlStringFromPasteboard: String? {
|
||||||
get {
|
|
||||||
if let urlString = NSPasteboard.rs_urlString(from: NSPasteboard.general) {
|
if let urlString = NSPasteboard.rs_urlString(from: NSPasteboard.general) {
|
||||||
return urlString.rs_normalizedURL()
|
return urlString.rs_normalizedURL()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
struct AccountAndFolderSpecifier {
|
struct AccountAndFolderSpecifier {
|
||||||
let account: Account
|
let account: Account
|
||||||
|
@ -33,7 +33,6 @@ class AddFeedWindowController : NSWindowController {
|
|||||||
fileprivate var folderTreeController: TreeController!
|
fileprivate var folderTreeController: TreeController!
|
||||||
|
|
||||||
private var userEnteredTitle: String? {
|
private var userEnteredTitle: String? {
|
||||||
get {
|
|
||||||
var s = nameTextField.stringValue
|
var s = nameTextField.stringValue
|
||||||
s = s.rs_stringWithCollapsedWhitespace()
|
s = s.rs_stringWithCollapsedWhitespace()
|
||||||
if s.isEmpty {
|
if s.isEmpty {
|
||||||
@ -41,7 +40,6 @@ class AddFeedWindowController : NSWindowController {
|
|||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var hostWindow: NSWindow!
|
var hostWindow: NSWindow!
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@ class MainWindowSplitView: NSSplitView {
|
|||||||
private let splitViewDividerColor = NSColor(calibratedWhite: 0.65, alpha: 1.0)
|
private let splitViewDividerColor = NSColor(calibratedWhite: 0.65, alpha: 1.0)
|
||||||
|
|
||||||
override var dividerColor: NSColor {
|
override var dividerColor: NSColor {
|
||||||
get {
|
|
||||||
return splitViewDividerColor
|
return splitViewDividerColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -75,10 +75,8 @@ class SidebarCell : NSTableCellView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override var isFlipped: Bool {
|
override var isFlipped: Bool {
|
||||||
get {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private func commonInit() {
|
private func commonInit() {
|
||||||
|
|
||||||
|
@ -25,10 +25,8 @@ final class SidebarStatusBarView: NSView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override var isFlipped: Bool {
|
override var isFlipped: Bool {
|
||||||
get {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override func awakeFromNib() {
|
override func awakeFromNib() {
|
||||||
|
|
||||||
|
@ -27,16 +27,13 @@ class UnreadCountView : NSView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var unreadCountString: String {
|
var unreadCountString: String {
|
||||||
get {
|
|
||||||
return unreadCount < 1 ? "" : "\(unreadCount)"
|
return unreadCount < 1 ? "" : "\(unreadCount)"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private var intrinsicContentSizeIsValid = false
|
private var intrinsicContentSizeIsValid = false
|
||||||
private var _intrinsicContentSize = NSZeroSize
|
private var _intrinsicContentSize = NSZeroSize
|
||||||
|
|
||||||
override var intrinsicContentSize: NSSize {
|
override var intrinsicContentSize: NSSize {
|
||||||
get {
|
|
||||||
if !intrinsicContentSizeIsValid {
|
if !intrinsicContentSizeIsValid {
|
||||||
var size = NSZeroSize
|
var size = NSZeroSize
|
||||||
if unreadCount > 0 {
|
if unreadCount > 0 {
|
||||||
@ -49,13 +46,10 @@ class UnreadCountView : NSView {
|
|||||||
}
|
}
|
||||||
return _intrinsicContentSize
|
return _intrinsicContentSize
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override var isFlipped: Bool {
|
override var isFlipped: Bool {
|
||||||
get {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override func invalidateIntrinsicContentSize() {
|
override func invalidateIntrinsicContentSize() {
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ class TimelineTableRowView : NSTableRowView {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
private var cellView: TimelineTableCellView? {
|
private var cellView: TimelineTableCellView? {
|
||||||
get {
|
|
||||||
for oneSubview in subviews {
|
for oneSubview in subviews {
|
||||||
if let foundView = oneSubview as? TimelineTableCellView {
|
if let foundView = oneSubview as? TimelineTableCellView {
|
||||||
return foundView
|
return foundView
|
||||||
@ -31,7 +30,6 @@ class TimelineTableRowView : NSTableRowView {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override var isEmphasized: Bool {
|
override var isEmphasized: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
@ -50,11 +48,8 @@ class TimelineTableRowView : NSTableRowView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var gridRect: NSRect {
|
var gridRect: NSRect {
|
||||||
get {
|
|
||||||
// return NSMakeRect(floor(cellAppearance.boxLeftMargin), NSMaxY(bounds) - 1.0, NSWidth(bounds), 1)
|
|
||||||
return NSMakeRect(0.0, NSMaxY(bounds) - 1.0, NSWidth(bounds), 1)
|
return NSMakeRect(0.0, NSMaxY(bounds) - 1.0, NSWidth(bounds), 1)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override func drawSeparator(in dirtyRect: NSRect) {
|
override func drawSeparator(in dirtyRect: NSRect) {
|
||||||
|
|
||||||
|
@ -18,16 +18,12 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||||||
@IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate?
|
@IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate?
|
||||||
|
|
||||||
var selectedArticles: [Article] {
|
var selectedArticles: [Article] {
|
||||||
get {
|
|
||||||
return Array(articles.articlesForIndexes(tableView.selectedRowIndexes))
|
return Array(articles.articlesForIndexes(tableView.selectedRowIndexes))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var hasAtLeastOneSelectedArticle: Bool {
|
var hasAtLeastOneSelectedArticle: Bool {
|
||||||
get {
|
|
||||||
return tableView.selectedRow != -1
|
return tableView.selectedRow != -1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var articles = ArticleArray() {
|
var articles = ArticleArray() {
|
||||||
didSet {
|
didSet {
|
||||||
@ -105,10 +101,8 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var oneSelectedArticle: Article? {
|
private var oneSelectedArticle: Article? {
|
||||||
get {
|
|
||||||
return selectedArticles.count == 1 ? selectedArticles.first : nil
|
return selectedArticles.count == 1 ? selectedArticles.first : nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
|
||||||
|
@ -96,10 +96,8 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
|
|||||||
private extension PreferencesWindowController {
|
private extension PreferencesWindowController {
|
||||||
|
|
||||||
var currentView: NSView? {
|
var currentView: NSView? {
|
||||||
get {
|
|
||||||
return window?.contentView?.subviews.first
|
return window?.contentView?.subviews.first
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func toolbarItemSpec(for identifier: String) -> PreferencesToolbarItemSpec? {
|
func toolbarItemSpec(for identifier: String) -> PreferencesToolbarItemSpec? {
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ private var smartFeedIcon: NSImage = {
|
|||||||
extension PseudoFeed {
|
extension PseudoFeed {
|
||||||
|
|
||||||
var smallIcon: NSImage? {
|
var smallIcon: NSImage? {
|
||||||
get {
|
|
||||||
return smartFeedIcon
|
return smartFeedIcon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -19,10 +19,8 @@ protocol SmartFeedDelegate: DisplayNameProvider, ArticleFetcher {
|
|||||||
final class SmartFeed: PseudoFeed {
|
final class SmartFeed: PseudoFeed {
|
||||||
|
|
||||||
var nameForDisplay: String {
|
var nameForDisplay: String {
|
||||||
get {
|
|
||||||
return delegate.nameForDisplay
|
return delegate.nameForDisplay
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var unreadCount = 0 {
|
var unreadCount = 0 {
|
||||||
didSet {
|
didSet {
|
||||||
|
@ -102,16 +102,12 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var refreshProgress: DownloadProgress {
|
var refreshProgress: DownloadProgress {
|
||||||
get {
|
|
||||||
return delegate.refreshProgress
|
return delegate.refreshProgress
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var supportsSubFolders: Bool {
|
var supportsSubFolders: Bool {
|
||||||
get {
|
|
||||||
return delegate.supportsSubFolders
|
return delegate.supportsSubFolders
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init?(dataFolder: String, settingsFile: String, type: AccountType, accountID: String) {
|
init?(dataFolder: String, settingsFile: String, type: AccountType, accountID: String) {
|
||||||
|
|
||||||
|
@ -31,19 +31,14 @@ public final class AccountManager: UnreadCountProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var accounts: [Account] {
|
public var accounts: [Account] {
|
||||||
get {
|
|
||||||
return Array(accountsDictionary.values)
|
return Array(accountsDictionary.values)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var sortedAccounts: [Account] {
|
public var sortedAccounts: [Account] {
|
||||||
get {
|
|
||||||
return accountsSortedByName()
|
return accountsSortedByName()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var refreshInProgress: Bool {
|
public var refreshInProgress: Bool {
|
||||||
get {
|
|
||||||
for account in accounts {
|
for account in accounts {
|
||||||
if account.refreshInProgress {
|
if account.refreshInProgress {
|
||||||
return true
|
return true
|
||||||
@ -51,14 +46,11 @@ public final class AccountManager: UnreadCountProvider {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var combinedRefreshProgress: CombinedRefreshProgress {
|
public var combinedRefreshProgress: CombinedRefreshProgress {
|
||||||
get {
|
|
||||||
let downloadProgressArray = accounts.map { $0.refreshProgress }
|
let downloadProgressArray = accounts.map { $0.refreshProgress }
|
||||||
return CombinedRefreshProgress(downloadProgressArray: downloadProgressArray)
|
return CombinedRefreshProgress(downloadProgressArray: downloadProgressArray)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
|
|
||||||
|
@ -18,10 +18,8 @@ public extension Notification.Name {
|
|||||||
public extension Feed {
|
public extension Feed {
|
||||||
|
|
||||||
public var account: Account? {
|
public var account: Account? {
|
||||||
get {
|
|
||||||
return AccountManager.shared.existingAccount(with: accountID)
|
return AccountManager.shared.existingAccount(with: accountID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func takeSettings(from parsedFeed: ParsedFeed) {
|
public func takeSettings(from parsedFeed: ParsedFeed) {
|
||||||
|
|
||||||
@ -59,15 +57,11 @@ public extension Feed {
|
|||||||
public extension Article {
|
public extension Article {
|
||||||
|
|
||||||
public var account: Account? {
|
public var account: Account? {
|
||||||
get {
|
|
||||||
return AccountManager.shared.existingAccount(with: accountID)
|
return AccountManager.shared.existingAccount(with: accountID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var feed: Feed? {
|
public var feed: Feed? {
|
||||||
get {
|
|
||||||
return account?.existingFeed(with: feedID)
|
return account?.existingFeed(with: feedID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -14,10 +14,8 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
|||||||
let supportsSubFolders = false
|
let supportsSubFolders = false
|
||||||
|
|
||||||
var refreshProgress: DownloadProgress {
|
var refreshProgress: DownloadProgress {
|
||||||
get {
|
|
||||||
return DownloadProgress(numberOfTasks: 0) // TODO
|
return DownloadProgress(numberOfTasks: 0) // TODO
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func refreshAll(for: Account) {
|
func refreshAll(for: Account) {
|
||||||
|
|
||||||
|
@ -29,10 +29,7 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
|||||||
// MARK: - DisplayNameProvider
|
// MARK: - DisplayNameProvider
|
||||||
|
|
||||||
public var nameForDisplay: String {
|
public var nameForDisplay: String {
|
||||||
get {
|
|
||||||
return name ?? Folder.untitledName
|
return name ?? Folder.untitledName
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - UnreadCountProvider
|
// MARK: - UnreadCountProvider
|
||||||
@ -84,7 +81,6 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dictionary: [String: Any] {
|
var dictionary: [String: Any] {
|
||||||
get {
|
|
||||||
|
|
||||||
var d = [String: Any]()
|
var d = [String: Any]()
|
||||||
guard let account = account else {
|
guard let account = account else {
|
||||||
@ -116,7 +112,6 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Feeds
|
// MARK: Feeds
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@ final class LocalAccountDelegate: AccountDelegate {
|
|||||||
private let refresher = LocalAccountRefresher()
|
private let refresher = LocalAccountRefresher()
|
||||||
|
|
||||||
var refreshProgress: DownloadProgress {
|
var refreshProgress: DownloadProgress {
|
||||||
get {
|
|
||||||
return refresher.progress
|
return refresher.progress
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func refreshAll(for account: Account) {
|
func refreshAll(for account: Account) {
|
||||||
|
|
||||||
|
@ -19,10 +19,8 @@ final class LocalAccountRefresher {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
var progress: DownloadProgress {
|
var progress: DownloadProgress {
|
||||||
get {
|
|
||||||
return downloadSession.progress
|
return downloadSession.progress
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func refreshFeeds(_ feeds: Set<Feed>) {
|
public func refreshFeeds(_ feeds: Set<Feed>) {
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
|||||||
// MARK: - DisplayNameProvider
|
// MARK: - DisplayNameProvider
|
||||||
|
|
||||||
public var nameForDisplay: String {
|
public var nameForDisplay: String {
|
||||||
get {
|
|
||||||
if let s = editedName, !s.isEmpty {
|
if let s = editedName, !s.isEmpty {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@ -43,7 +42,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
|||||||
}
|
}
|
||||||
return NSLocalizedString("Untitled", comment: "Feed name")
|
return NSLocalizedString("Untitled", comment: "Feed name")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - UnreadCountProvider
|
// MARK: - UnreadCountProvider
|
||||||
|
|
||||||
@ -115,7 +113,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var dictionary: [String: Any] {
|
public var dictionary: [String: Any] {
|
||||||
get {
|
|
||||||
var d = [String: Any]()
|
var d = [String: Any]()
|
||||||
|
|
||||||
d[Key.url] = url
|
d[Key.url] = url
|
||||||
@ -155,7 +152,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Debug
|
// MARK: - Debug
|
||||||
|
|
||||||
|
@ -110,10 +110,8 @@ extension Article: DatabaseObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var databaseID: String {
|
public var databaseID: String {
|
||||||
get {
|
|
||||||
return articleID
|
return articleID
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func relatedObjectsWithName(_ name: String) -> [DatabaseObject]? {
|
public func relatedObjectsWithName(_ name: String) -> [DatabaseObject]? {
|
||||||
|
|
||||||
|
@ -26,10 +26,8 @@ extension ArticleStatus {
|
|||||||
extension ArticleStatus: DatabaseObject {
|
extension ArticleStatus: DatabaseObject {
|
||||||
|
|
||||||
public var databaseID: String {
|
public var databaseID: String {
|
||||||
get {
|
|
||||||
return articleID
|
return articleID
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func databaseDictionary() -> NSDictionary? {
|
public func databaseDictionary() -> NSDictionary? {
|
||||||
|
|
||||||
|
@ -57,10 +57,8 @@ private func optionalIntForColumn(_ row: FMResultSet, _ columnName: String) -> I
|
|||||||
extension Attachment: DatabaseObject {
|
extension Attachment: DatabaseObject {
|
||||||
|
|
||||||
public var databaseID: String {
|
public var databaseID: String {
|
||||||
get {
|
|
||||||
return attachmentID
|
return attachmentID
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func databaseDictionary() -> NSDictionary? {
|
public func databaseDictionary() -> NSDictionary? {
|
||||||
|
|
||||||
|
@ -45,10 +45,8 @@ extension Author {
|
|||||||
extension Author: DatabaseObject {
|
extension Author: DatabaseObject {
|
||||||
|
|
||||||
public var databaseID: String {
|
public var databaseID: String {
|
||||||
get {
|
|
||||||
return authorID
|
return authorID
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func databaseDictionary() -> NSDictionary? {
|
public func databaseDictionary() -> NSDictionary? {
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import Data
|
|||||||
extension ParsedItem {
|
extension ParsedItem {
|
||||||
|
|
||||||
var articleID: String {
|
var articleID: String {
|
||||||
get {
|
|
||||||
if let s = syncServiceID {
|
if let s = syncServiceID {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@ -21,4 +20,3 @@ extension ParsedItem {
|
|||||||
return Article.calculatedArticleID(feedID: feedURL, uniqueID: uniqueID)
|
return Article.calculatedArticleID(feedID: feedURL, uniqueID: uniqueID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -179,10 +179,8 @@ private final class StatusCache {
|
|||||||
|
|
||||||
var dictionary = [String: ArticleStatus]()
|
var dictionary = [String: ArticleStatus]()
|
||||||
var cachedStatuses: Set<ArticleStatus> {
|
var cachedStatuses: Set<ArticleStatus> {
|
||||||
get {
|
|
||||||
return Set(dictionary.values)
|
return Set(dictionary.values)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func add(_ statuses: Set<ArticleStatus>) {
|
func add(_ statuses: Set<ArticleStatus>) {
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ public struct UnreadCountDictionary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public subscript(_ feed: Feed) -> Int? {
|
public subscript(_ feed: Feed) -> Int? {
|
||||||
get {
|
|
||||||
return dictionary[feed.feedID]
|
return dictionary[feed.feedID]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -22,10 +22,8 @@ public final class BatchUpdate {
|
|||||||
private var count = 0
|
private var count = 0
|
||||||
|
|
||||||
public var isPerforming: Bool {
|
public var isPerforming: Bool {
|
||||||
get {
|
|
||||||
return count > 0
|
return count > 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func perform(_ batchUpdateBlock: BatchUpdateBlock) {
|
public func perform(_ batchUpdateBlock: BatchUpdateBlock) {
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ import AppKit
|
|||||||
public extension NSOutlineView {
|
public extension NSOutlineView {
|
||||||
|
|
||||||
var selectedItems: [AnyObject] {
|
var selectedItems: [AnyObject] {
|
||||||
get {
|
|
||||||
|
|
||||||
if selectionIsEmpty {
|
if selectionIsEmpty {
|
||||||
return [AnyObject]()
|
return [AnyObject]()
|
||||||
}
|
}
|
||||||
@ -21,7 +19,6 @@ public extension NSOutlineView {
|
|||||||
return item(atRow: oneIndex) as AnyObject
|
return item(atRow: oneIndex) as AnyObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var firstSelectedRow: Int? {
|
var firstSelectedRow: Int? {
|
||||||
|
|
||||||
|
@ -11,10 +11,8 @@ import AppKit
|
|||||||
public extension NSTableView {
|
public extension NSTableView {
|
||||||
|
|
||||||
var selectionIsEmpty: Bool {
|
var selectionIsEmpty: Bool {
|
||||||
get {
|
|
||||||
return selectedRowIndexes.startIndex == selectedRowIndexes.endIndex
|
return selectedRowIndexes.startIndex == selectedRowIndexes.endIndex
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func indexesOfAvailableRowsPassingTest(_ test: (Int) -> Bool) -> IndexSet? {
|
func indexesOfAvailableRowsPassingTest(_ test: (Int) -> Bool) -> IndexSet? {
|
||||||
|
|
||||||
|
@ -52,11 +52,9 @@ struct RelatedObjectIDsMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subscript(_ objectID: String) -> Set<String>? {
|
subscript(_ objectID: String) -> Set<String>? {
|
||||||
get {
|
|
||||||
return dictionary[objectID]
|
return dictionary[objectID]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
struct LookupValue: Hashable {
|
struct LookupValue: Hashable {
|
||||||
|
|
||||||
|
@ -39,8 +39,6 @@ public struct RelatedObjectsMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public subscript(_ objectID: String) -> [DatabaseObject]? {
|
public subscript(_ objectID: String) -> [DatabaseObject]? {
|
||||||
get {
|
|
||||||
return dictionary[objectID]
|
return dictionary[objectID]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -25,10 +25,8 @@ public struct FeedSpecifier: Hashable {
|
|||||||
public let source: Source
|
public let source: Source
|
||||||
public let hashValue: Int
|
public let hashValue: Int
|
||||||
public var score: Int {
|
public var score: Int {
|
||||||
get {
|
|
||||||
return calculatedScore()
|
return calculatedScore()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init(title: String?, urlString: String, source: Source) {
|
init(title: String?, urlString: String, source: Source) {
|
||||||
|
|
||||||
|
@ -14,10 +14,8 @@ private let feedURLWordsToMatch = ["feed", "xml", "rss", "atom", "json"]
|
|||||||
class HTMLFeedFinder {
|
class HTMLFeedFinder {
|
||||||
|
|
||||||
var feedSpecifiers: Set<FeedSpecifier> {
|
var feedSpecifiers: Set<FeedSpecifier> {
|
||||||
get {
|
|
||||||
return Set(feedSpecifiersDictionary.values)
|
return Set(feedSpecifiersDictionary.values)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate var feedSpecifiersDictionary = [String: FeedSpecifier]()
|
fileprivate var feedSpecifiersDictionary = [String: FeedSpecifier]()
|
||||||
|
|
||||||
|
@ -21,22 +21,17 @@ public final class Node: Hashable {
|
|||||||
private static var incrementingID = 0
|
private static var incrementingID = 0
|
||||||
|
|
||||||
public var isRoot: Bool {
|
public var isRoot: Bool {
|
||||||
get {
|
|
||||||
if let _ = parent {
|
if let _ = parent {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var numberOfChildNodes: Int {
|
public var numberOfChildNodes: Int {
|
||||||
get {
|
|
||||||
return childNodes?.count ?? 0
|
return childNodes?.count ?? 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var indexPath: IndexPath {
|
public var indexPath: IndexPath {
|
||||||
get {
|
|
||||||
if let parent = parent {
|
if let parent = parent {
|
||||||
let parentPath = parent.indexPath
|
let parentPath = parent.indexPath
|
||||||
if let childIndex = parent.indexOfChild(self) {
|
if let childIndex = parent.indexOfChild(self) {
|
||||||
@ -46,22 +41,17 @@ public final class Node: Hashable {
|
|||||||
}
|
}
|
||||||
return IndexPath(index: 0) //root node
|
return IndexPath(index: 0) //root node
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var level: Int {
|
public var level: Int {
|
||||||
get {
|
|
||||||
if let parent = parent {
|
if let parent = parent {
|
||||||
return parent.level + 1
|
return parent.level + 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var isLeaf: Bool {
|
public var isLeaf: Bool {
|
||||||
get {
|
|
||||||
return numberOfChildNodes < 1
|
return numberOfChildNodes < 1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public init(representedObject: AnyObject, parent: Node?) {
|
public init(representedObject: AnyObject, parent: Node?) {
|
||||||
|
|
||||||
|
@ -14,10 +14,8 @@ public final class DownloadObject: Hashable {
|
|||||||
public var data = Data()
|
public var data = Data()
|
||||||
|
|
||||||
public var hashValue: Int {
|
public var hashValue: Int {
|
||||||
get {
|
|
||||||
return url.hashValue
|
return url.hashValue
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public init(url: URL) {
|
public init(url: URL) {
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ public final class DownloadProgress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var numberCompleted: Int {
|
public var numberCompleted: Int {
|
||||||
get {
|
|
||||||
var n = numberOfTasks - numberRemaining
|
var n = numberOfTasks - numberRemaining
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
n = 0
|
n = 0
|
||||||
@ -45,13 +44,10 @@ public final class DownloadProgress {
|
|||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var isComplete: Bool {
|
public var isComplete: Bool {
|
||||||
get {
|
|
||||||
return numberRemaining < 1
|
return numberRemaining < 1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public init(numberOfTasks: Int) {
|
public init(numberOfTasks: Int) {
|
||||||
|
|
||||||
|
@ -294,10 +294,8 @@ private final class DownloadInfo {
|
|||||||
var canceled = false
|
var canceled = false
|
||||||
|
|
||||||
var statusCode: Int {
|
var statusCode: Int {
|
||||||
get {
|
|
||||||
return urlResponse?.forcedStatusCode ?? 0
|
return urlResponse?.forcedStatusCode ?? 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init(_ representedObject: AnyObject, urlRequest: URLRequest) {
|
init(_ representedObject: AnyObject, urlRequest: URLRequest) {
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ public struct HTTPConditionalGetInfo {
|
|||||||
public let etag: String?
|
public let etag: String?
|
||||||
|
|
||||||
public var dictionary: [String: String] {
|
public var dictionary: [String: String] {
|
||||||
get {
|
|
||||||
var d = [String: String]()
|
var d = [String: String]()
|
||||||
if let lastModified = lastModified {
|
if let lastModified = lastModified {
|
||||||
d[HTTPResponseHeader.lastModified] = lastModified
|
d[HTTPResponseHeader.lastModified] = lastModified
|
||||||
@ -24,7 +23,6 @@ public struct HTTPConditionalGetInfo {
|
|||||||
}
|
}
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public init?(lastModified: String?, etag: String?) {
|
public init?(lastModified: String?, etag: String?) {
|
||||||
|
|
||||||
|
@ -11,14 +11,11 @@ import Foundation
|
|||||||
public extension URLResponse {
|
public extension URLResponse {
|
||||||
|
|
||||||
public var statusIsOK: Bool {
|
public var statusIsOK: Bool {
|
||||||
get {
|
|
||||||
return forcedStatusCode >= 200 && forcedStatusCode <= 299
|
return forcedStatusCode >= 200 && forcedStatusCode <= 299
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public var forcedStatusCode: Int {
|
public var forcedStatusCode: Int {
|
||||||
|
|
||||||
get {
|
|
||||||
// Return actual statusCode or -1 if there isn’t one.
|
// Return actual statusCode or -1 if there isn’t one.
|
||||||
|
|
||||||
if let response = self as? HTTPURLResponse {
|
if let response = self as? HTTPURLResponse {
|
||||||
@ -27,7 +24,6 @@ public extension URLResponse {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public extension HTTPURLResponse {
|
public extension HTTPURLResponse {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user