Skip to content

Instantly share code, notes, and snippets.

@ershovio
Last active November 23, 2019 14:50
Show Gist options
  • Save ershovio/c2214ba439a3991b29eab30d26bbe6e1 to your computer and use it in GitHub Desktop.
Save ershovio/c2214ba439a3991b29eab30d26bbe6e1 to your computer and use it in GitHub Desktop.
Пример MagnificationGesture
struct MagnificationGestureExample: View {
@State var rectangleScaleEffect: CGFloat = CGFloat(1)
var body: some View {
// Создаем MagnificationGesture
let magnificationGesture = MagnificationGesture()
// Изменяем scale effect для прямоугольника
.onChanged { value in
self.rectangleScaleEffect = value
}
return Rectangle()
.foregroundColor(.green)
.cornerRadius(40)
// Изменяем масштаб прямоугольника
.scaleEffect(rectangleScaleEffect)
.frame(width: 200, height: 100, alignment: .center)
// Добавляем gesture к view
.gesture(magnificationGesture)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment