mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-18 14:59:50 +02:00
Update README.md
This commit is contained in:
12
README.md
12
README.md
@@ -64,15 +64,6 @@ In class add property:
|
|||||||
@GestureState var dragState = DragState.inactive
|
@GestureState var dragState = DragState.inactive
|
||||||
```
|
```
|
||||||
|
|
||||||
And in `body` create gester object:
|
|
||||||
|
|
||||||
```
|
|
||||||
let dragGester = DragGesture()
|
|
||||||
.updating($dragState) { (value, state, transaction) in
|
|
||||||
state = .dragging(translation: value.translation)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To card add `gester` and `offset`:
|
To card add `gester` and `offset`:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
@@ -80,9 +71,6 @@ To card add `gester` and `offset`:
|
|||||||
x: dragState.translation.width,
|
x: dragState.translation.width,
|
||||||
y: dragState.translation.height
|
y: dragState.translation.height
|
||||||
)
|
)
|
||||||
.rotationEffect(Angle(degrees: Double(dragState.translation.width / 10)))
|
|
||||||
.shadow(radius: dragState.isActive ? 8 : 0)
|
|
||||||
.animation(.spring())
|
|
||||||
.gesture(dragGester)
|
.gesture(dragGester)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user