SwipeView
SwipeView copied to clipboard
SwipeOptions.swift:41:46: 'UIView?' does not have a member named 'frame'
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()
}
})
}
}