Created
November 13, 2016 05:22
-
-
Save zntfdr/b38c90f3723b8a26992d6dfd88f11a34 to your computer and use it in GitHub Desktop.
This file contains 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
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