Advertisement
Don_Mag

Untitled

Jun 6th, 2021
1,499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.65 KB | None | 0 0
  1. class ViewController: UIViewController {
  2.    
  3.     var img1: UIImage!
  4.    
  5.     override func viewDidLoad() {
  6.         super.viewDidLoad()
  7.        
  8.         guard let i1 = UIImage(named: "p3x3"),
  9.               let i2 = UIImage(named: "p2x2"),
  10.               let i3 = UIImage(named: "p1x1")
  11.         else {
  12.             fatalError("failed to load images")
  13.         }
  14.        
  15.         i1.mergeWithTopmage(topImage: i2, completion: { img in
  16.             img.mergeWithTopmage(topImage: i3, completion: { img in
  17.                 self.img1 = img
  18.             })
  19.         })
  20.     }
  21.    
  22.     override func viewDidAppear(_ animated: Bool) {
  23.         super.viewDidAppear(animated)
  24.        
  25.         let imgView = UIImageView(image: img1)
  26.         view.addSubview(imgView)
  27.         imgView.center = view.center
  28.        
  29.     }
  30.    
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement