This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |