PDFGenerator icon indicating copy to clipboard operation
PDFGenerator copied to clipboard

Unable to show Symbol Image correctly (Bug)

Open HassanTaleb90 opened this issue 2 years ago • 0 comments
trafficstars

If there is a Symbol image, the result is incorrect. The image will appear as a color covering its entire frame.

Example:

let imgA = UIImage(systemName: "swift")!

My solution is to transform it to a regular image using this code:

extension UIImage {
	/// Convert any image (e.g symbol image) to regular image
	var regularImage: UIImage {
		return UIGraphicsImageRenderer(size: size).image { _ in
			draw(in: CGRect(origin: .zero, size: size))
		}
	}
}

Usage:

let imgA = UIImage(systemName: "swift")!
let imgB = imgA.regularImage

HassanTaleb90 avatar Sep 17 '23 07:09 HassanTaleb90