Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 29, 2021 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/fd825ecaed39acf2addab6f00b8eda62 to your computer and use it in GitHub Desktop.
Save iosdevie/fd825ecaed39acf2addab6f00b8eda62 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State var magnificationValue: CGFloat = CGFloat(1)
@State var rotationValue: Angle = .zero
var body: some View {
Rectangle()
.foregroundColor(Color.purple)
.cornerRadius(40)
.scaleEffect(magnificationValue)
.rotationEffect(rotationValue)
.frame(width: 200, height: 200, alignment: .center)
.gesture(MagnificationGesture()
.onChanged { value in
self.magnificationValue = value
}
.simultaneously(with: RotationGesture().onChanged { value in
self.rotationValue = value
}))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment