2019-04-11 17:53:03 -05:00
|
|
|
//
|
|
|
|
|
// RSImage-Extensions.swift
|
2026-05-29 10:46:00 -07:00
|
|
|
// NetNewsWire
|
2019-04-11 17:53:03 -05:00
|
|
|
//
|
|
|
|
|
// Created by Maurice Parker on 4/11/19.
|
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
2020-03-19 22:22:58 -07:00
|
|
|
import RSCore
|
2026-05-29 10:46:00 -07:00
|
|
|
import Images
|
2020-01-16 20:09:18 -06:00
|
|
|
#if os(macOS)
|
|
|
|
|
import AppKit
|
|
|
|
|
#else
|
|
|
|
|
import UIKit
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-04-11 17:53:03 -05:00
|
|
|
extension RSImage {
|
2025-11-19 16:22:26 -08:00
|
|
|
|
|
|
|
|
static var appIconImage: RSImage? {
|
|
|
|
|
#if os(macOS)
|
|
|
|
|
return RSImage(named: NSImage.applicationIconName)
|
|
|
|
|
#elseif os(iOS)
|
|
|
|
|
// https://stackoverflow.com/a/51241158/14256
|
|
|
|
|
if let icons = Bundle.main.infoDictionary?["CFBundleIcons"] as? [String: Any],
|
|
|
|
|
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
|
|
|
|
|
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
|
|
|
|
|
let lastIcon = iconFiles.last {
|
|
|
|
|
return RSImage(named: lastIcon)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension IconImage {
|
|
|
|
|
static let appIcon: IconImage? = {
|
|
|
|
|
if let image = RSImage.appIconImage {
|
|
|
|
|
return IconImage(image)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
static let nnwFeedIcon = IconImage(Assets.Images.nnwFeedIcon)
|
2019-06-14 15:33:13 -05:00
|
|
|
}
|