34 lines
734 B
Swift
34 lines
734 B
Swift
//
|
|
// SymbolCache.swift
|
|
// Gemini-iOS
|
|
//
|
|
// Created by Shadowfacts on 12/17/20.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
struct SymbolCache {
|
|
|
|
private(set) static var symbols = [String: String]()
|
|
|
|
private static let defaultSymbols = [
|
|
"arrow.right",
|
|
"link",
|
|
"safari",
|
|
"envelope",
|
|
"arrow.up.left.square",
|
|
]
|
|
|
|
static func load() {
|
|
defaultSymbols.forEach { loadSymbol(name: $0) }
|
|
}
|
|
|
|
private static func loadSymbol(name: String) {
|
|
let config = UIImage.SymbolConfiguration(pointSize: 16)
|
|
let symbol = UIImage(systemName: name, withConfiguration: config)!
|
|
let data = symbol.pngData()!
|
|
symbols[name] = data.base64EncodedString()
|
|
}
|
|
|
|
}
|