Skip to content

Instantly share code, notes, and snippets.

@zntfdr
Created November 13, 2016 05:22
Show Gist options
  • Save zntfdr/b38c90f3723b8a26992d6dfd88f11a34 to your computer and use it in GitHub Desktop.
Save zntfdr/b38c90f3723b8a26992d6dfd88f11a34 to your computer and use it in GitHub Desktop.
import UIKit
class MyView: UIView {
fileprivate var myPreviewInteraction: Any? = nil
init() {
super.init(frame: CGRect.zero)
if #available(iOS 10.0, *) {
myPreviewInteraction = UIPreviewInteraction(view: self)
(myPreviewInteraction as! UIPreviewInteraction).delegate = self
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
@available(iOS 10.0, *)
extension MyView: UIPreviewInteractionDelegate {
public func previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdatePreviewTransition transitionProgress: CGFloat, ended: Bool) { }
public func previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment