Make Feed and Folder conform to Renewable.

This commit is contained in:
Brent Simmons 2018-11-22 13:57:49 -08:00
parent 7d4319ff43
commit b900cbc0b7
2 changed files with 14 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import RSWeb
import Articles
import RSDatabase
public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Hashable {
private struct Key {
static let url = "url"
@ -140,6 +140,12 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
return NSLocalizedString("Untitled", comment: "Feed name")
}
// MARK: - Renamable
public func rename(to newName: String) {
editedName = newName
}
// MARK: - UnreadCountProvider
public var unreadCount: Int {

View File

@ -10,7 +10,7 @@ import Foundation
import Articles
import RSCore
public final class Folder: DisplayNameProvider, Container, UnreadCountProvider, Hashable {
public final class Folder: DisplayNameProvider, Renamable, Container, UnreadCountProvider, Hashable {
public weak var account: Account?
@ -43,6 +43,12 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
}
}
// MARK: - Renamable
public func rename(to newName: String) {
name = newName
}
// MARK: - Init
init(account: Account, name: String?) {