Group Group Group Group Group Group Group Group Group

Losing metadata while saving UIImage in HEIC format

Hello,
Thank you for the this content! As a new Swift developer I grateful for this resource.

I am following this tutorial HEIC Image Compression for iOS | raywenderlich.com to save a UIImage in HEIC format and everything works great except I noticed that some of the metadata information is lost when the heicData function is called on the image. Specifically I noticed that the Orientation information is lost.

What would be the best way to fix this?