diff --git a/INSPhotoGallery/INSPhotosTransitionAnimator.swift b/INSPhotoGallery/INSPhotosTransitionAnimator.swift index 93b745b..f11a4ed 100644 --- a/INSPhotoGallery/INSPhotosTransitionAnimator.swift +++ b/INSPhotoGallery/INSPhotosTransitionAnimator.swift @@ -86,14 +86,16 @@ class INSPhotosTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioni if let toView = transitionContext.viewForKey(UITransitionContextToViewKey), let toViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey) { toView.frame = transitionContext.finalFrameForViewController(toViewController) - if let containerView = transitionContext.containerView() where !toView.isDescendantOfView(containerView) { + let containerView = transitionContext.containerView() + + if !toView.isDescendantOfView(containerView) { containerView.addSubview(toView) } } if dismissing { if let fromView = transitionContext.viewForKey(UITransitionContextFromViewKey) { - transitionContext.containerView()?.bringSubviewToFront(fromView) + transitionContext.containerView().bringSubviewToFront(fromView) } } } @@ -116,9 +118,7 @@ class INSPhotosTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioni func performZoomingAnimationWithTransitionContext(transitionContext: UIViewControllerContextTransitioning) { - guard let containerView = transitionContext.containerView() else { - return - } + let containerView = transitionContext.containerView() guard let startingView = startingView, let endingView = endingView else { return } @@ -185,4 +185,4 @@ class INSPhotosTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioni } transitionContext.completeTransition(!transitionContext.transitionWasCancelled()) } -} \ No newline at end of file +} diff --git a/INSPhotoGallery/INSPhotosViewController.swift b/INSPhotoGallery/INSPhotosViewController.swift index 326682e..be54a30 100644 --- a/INSPhotoGallery/INSPhotosViewController.swift +++ b/INSPhotoGallery/INSPhotosViewController.swift @@ -373,12 +373,12 @@ public class INSPhotosViewController: UIViewController, UIPageViewControllerData } public override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool { - if let _ = currentPhoto?.image ?? currentPhotoViewController?.scalingImageView.image where shouldHandleLongPressGesture && action == #selector(NSObject.copy(_:)) { + if let _ = currentPhoto?.image ?? currentPhotoViewController?.scalingImageView.image where shouldHandleLongPressGesture && action == #selector(NSObject.copy) { return true } return false } - + // MARK: - Status Bar public override func prefersStatusBarHidden() -> Bool { diff --git a/INSPhotoGallery/UIVIew+INSPhotoViewer.swift b/INSPhotoGallery/UIVIew+INSPhotoViewer.swift index 8fe2022..dc7eefc 100644 --- a/INSPhotoGallery/UIVIew+INSPhotoViewer.swift +++ b/INSPhotoGallery/UIVIew+INSPhotoViewer.swift @@ -39,7 +39,7 @@ extension UIView { return snapshotedView } else { - return snapshotViewAfterScreenUpdates(true) + return snapshotViewAfterScreenUpdates(true)! } }