mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add basic ExtensionPoint support.
This commit is contained in:
42
Shared/Extensions/SmallIconProvider.swift
Normal file
42
Shared/Extensions/SmallIconProvider.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// SmallIconProvider.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 12/16/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Articles
|
||||
import Account
|
||||
import RSCore
|
||||
|
||||
protocol SmallIconProvider {
|
||||
|
||||
var smallIcon: IconImage? { get }
|
||||
}
|
||||
|
||||
extension Account: SmallIconProvider {
|
||||
var smallIcon: IconImage? {
|
||||
if let image = AppAssets.image(for: type) {
|
||||
return IconImage(image)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
extension WebFeed: SmallIconProvider {
|
||||
|
||||
var smallIcon: IconImage? {
|
||||
if let iconImage = appDelegate.faviconDownloader.favicon(for: self) {
|
||||
return iconImage
|
||||
}
|
||||
return FaviconGenerator.favicon(self)
|
||||
}
|
||||
}
|
||||
|
||||
extension Folder: SmallIconProvider {
|
||||
var smallIcon: IconImage? {
|
||||
AppAssets.masterFolderImage
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user