Have you tried .simultaneousGesture() instead of .onTapGesture()? Certain views, like NavigationLink views, already have built-in tap gesture detection, so .onTapGesture() doesn't work.
simultaneousGesture() "attaches a gesture to the view to process simultaneously with gestures defined by the view."
Post
Replies
Boosts
Views
Activity
A Little Background
HEIC images can store image properties, but in many cases the metadata of a HEIC image is stored as EXIF or XMP metadata. That may be the metadata you need to edit.
Here is a little discussion and some code on getting EXIF data for an image: https://developer.apple.com/forums/thread/19881
Editing Image Metadata in Apple's Ecosystem
Regardless of the metadata type you are aiming to edit, Apple's Image I/O framework should help you get the job done: https://developer.apple.com/documentation/imageio
Apple's description of the Image I/O framework: "Read and write most image file formats. Manage color and access image metadata."