mastodon-app-ufficiale-ipho.../MastodonSDK/Sources/MastodonExtension/UIImage.swift

20 lines
488 B
Swift
Raw Normal View History

2021-07-16 10:21:47 +02:00
//
// UIImage.swift
//
//
// Created by MainasuK Cirno on 2021-7-16.
//
import UIKit
extension UIImage {
public static func placeholder(size: CGSize = CGSize(width: 1, height: 1), color: UIColor) -> UIImage {
let render = UIGraphicsImageRenderer(size: size)
return render.image { (context: UIGraphicsImageRendererContext) in
context.cgContext.setFillColor(color.cgColor)
context.fill(CGRect(origin: .zero, size: size))
}
}
}