mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 07:34:09 +01:00
29 lines
525 B
Swift
29 lines
525 B
Swift
|
//
|
||
|
// AuthorAvatarDownloader.swift
|
||
|
// Evergreen
|
||
|
//
|
||
|
// Created by Brent Simmons on 11/26/17.
|
||
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Cocoa
|
||
|
import Data
|
||
|
|
||
|
final class AuthorAvatarDownloader {
|
||
|
|
||
|
private let imageDownloader: ImageDownloader
|
||
|
|
||
|
init(imageDownloader: ImageDownloader) {
|
||
|
|
||
|
self.imageDownloader = imageDownloader
|
||
|
}
|
||
|
|
||
|
func image(for author: Author) -> NSImage? {
|
||
|
|
||
|
guard let avatarURL = author.avatarURL else {
|
||
|
return nil
|
||
|
}
|
||
|
return imageDownloader.image(for: avatarURL)
|
||
|
}
|
||
|
}
|