Skip to content

Instantly share code, notes, and snippets.

View SaladDays831's full-sized avatar
🇺🇦

Danylo SaladDays831

🇺🇦
  • Ukraine, Kyiv
  • 21:16 (UTC +03:00)
View GitHub Profile
@SaladDays831
SaladDays831 / Extensions.swift
Created February 18, 2020 20:40
[Swift] Set 2 PDFs to one UIImageView (merge multiple vector assets)
extension UIImageView {
func mergeTwoPDF(one: UIImage, two: UIImage) {
UIGraphicsBeginImageContextWithOptions(self.frame.size, false, UIScreen.main.scale)
let areaSize = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height)
one.draw(in: areaSize, blendMode: .normal, alpha: 1.0)
two.draw(in: areaSize, blendMode: .normal, alpha: 1.0)
//If you want to merge more than 2 images, just add them to the func parameters and repeat the line above with them
let mergedImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()