1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2025-02-03 10:47:35 +01:00
2021-07-16 16:21:47 +08:00

20 lines
488 B
Swift

//
// 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))
}
}
}