SwipeView icon indicating copy to clipboard operation
SwipeView copied to clipboard

SwipeOptions.swift:41:46: 'UIView?' does not have a member named 'frame'

Open datomnurdin opened this issue 10 years ago • 0 comments

I got this error message for this one

init()  {
        swipeCancelledAnimationDuration = 0.2
        swipeCancelledAnimationOptions = UIViewAnimationOptions.CurveEaseOut

        swipeAnimationDuration = 0.15;
        swipeAnimationOptions = UIViewAnimationOptions.CurveEaseIn;

        rotationFactor = 3.0;

        threshold = 100.0

        onPan = { _ -> () in }
        onChosen = { (result : SwipeResult) -> () in
            let duration = 0.15
            let options = UIViewAnimationOptions.CurveEaseInOut

            var viewRect = result.view!.frame
            var superviewRect = result.view!.superview.frame // error message here.
            var translation = result.translation

            let destination = viewRect.extendOutOfBounds(superviewRect, translationVector: translation)

            UIView.animateWithDuration(duration, delay: 0.0, options: options, animations: {
                result.view!.frame = destination;
            }, completion: {(finished : Bool) -> () in
                if (finished) {
                    result.view!.removeFromSuperview()
                    result.onCompletion()
                }
            })
        }
    }

datomnurdin avatar Mar 28 '15 00:03 datomnurdin