Skip to content

Instantly share code, notes, and snippets.

@rawnly
Last active May 17, 2019 11:19
Show Gist options
  • Save rawnly/a1448698bb16a31d794dce3bd5cd9a16 to your computer and use it in GitHub Desktop.
Save rawnly/a1448698bb16a31d794dce3bd5cd9a16 to your computer and use it in GitHub Desktop.
Gist for the medium article
import Foundation
import UIKit
class ViewController: UIViewController {
// MARK: - UI Initialization
// The image that we will zoom/drag
var imageView = UIImageView()
// The dark overlay layer behind the image
// that will be visible while gestures are recognized
var overlay: UIView = {
let view = UIView(frame: UIScreen.main.bounds);
view.alpha = 0
view.backgroundColor = .black
return view
}()
// Let's start
override func viewDidLoad() {
super.viewDidLoad()
// Here some basic setup
view.addSubview(overlay)
view.bringSubviewToFront(imageView)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment