Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flipping Views in SwiftUI

In my SwiftUI app, I have an Image:

enter image description here

I added this image using:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Image("shoe_test")
 .resizable()
 .frame(width: 275, height: 275)
 .rotationEffect(Angle(degrees: 30))

However, I would like to flip this image in the opposite direction, like:

Image 2

For this, I haven’t tried anything, but I had no luck with rotationEffect, and I can’t get my head over this, Any help is greatly appreciated,

>Solution :

You could use

.rotation3DEffect(.degrees(180), axis: (x: 0, y: 1, z: 0))

documentation

With the rotation3DEffect you can rotate your image in all 3 Dimensions.

  • rotating along the x axis will flip the image top/bottom
  • rotating along the y axis will mirror it right/left
  • rotating along the z axis will flip and mirror it.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading