I am trying to apply slide, fade and grow effect to my imageview. Following is my code
@IBAction func fadeIn(_ sender: Any) {
imageView.alpha=0
UIView.animate(withDuration: 1, animations: {
self.imageView.alpha=1
})
}
@IBAction func slideIn(_ sender: Any) {
imageView.center=CGPoint(x:imageView.center.x-500,y:imageView.center.y)
UIView.animate(withDuration: 2) {
self.imageView.center=CGPoint(x:self.imageView.center.x+500,y:self.imageView.center.y)
}
}
@IBAction func grow(_ sender: Any) {
imageView.frame=CGRect(x:0,y:0,width:0,height:0)
UIView.animate(withDuration: 1, animations: {
self.imageView.frame=CGRect(x:0,y:0,width:200,height:200)
})
}
Whenever i click on any of the button i get
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Any help would be greatly appreciated.