Last active
November 23, 2019 14:50
-
-
Save a-v-ershov/c2214ba439a3991b29eab30d26bbe6e1 to your computer and use it in GitHub Desktop.
Пример MagnificationGesture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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