I am new to swift (and Xcode development in general) and I was wondering how to make an ImageView on the storyboard clickable. What I\'m trying to do is make it so when its
You can do it even easier and make a image clickable via Storyboard with no coding at all.
UITapGestureRecognizer onto your UIImageView in Storyboard.@IBAction func imageClicked(_ sender: Any) {}UITapGestureRecognizer to the IBAction in your class by selecting the gesture recognizer in the Document Outline, then switching to the Connection Inspector Tab and dragging the Sent Actions -> Selector to your UIViewController where you then select the appropriate action you created previously.User Interaction Enabled on the image view. Done, a fully clickable UIImageView without writing a single line of code except the obvious function you want to invoke. But hey, if you for example want to push a segue instead, then you can go without coding at all by using the gesture recognizers Triggered Segues instead of its Sent Actions.
Though Storyboard have their limitations, theres no need to write code for clickable images. ;)