even if you turned it on by code, try switching to your storyboard to check "enable user interaction" in the image view, your code seems beautiful, try it and let me know.
plus, just think, try turning on interaction in the image view before you assign tapgesture :)
source share