Logic Explain
To support rotation,
- You need a rotation gesture to get the current rotation value that's provided by user pinching gesture
- Once you have the rotation value, you need a way to combine this "new" rotation together with the "old" rotation that already exists
Steps to follow
- Create a
RotationGesture
variable
- Your view rotation is equal to your origin rotation + the rotation created by your gesture
- After changing, you need to update the origin rotation to be the new rotation
- Apply the rotation to the view
- use
.gesture(rotationGesture)
to make effect of your gesture
- When applying rotation and offset, you need to rotate first, and then offset
- When applying gesture order, you need to apply DragGesture() first and then RotationGesture()