-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolom.swift
49 lines (36 loc) · 1.41 KB
/
colom.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// colom.swift
// playBook
//
// Created by Jose Fernandez del Valle on 9/11/20.
// Copyright © 2020 All rights reserved.
//
import SwiftUI
struct colom: View {
@State private var Position: CGSize = .zero
@State private var NewPosition: CGSize = .zero
var body: some View {
Image("colom")
.resizable()
.clipShape(Circle())
.frame(width:60, height: 45)
.padding(.trailing, 20)
.offset(x: self.Position.width, y: self.Position.height)
.gesture(DragGesture()
.onChanged { value in
self.Position = CGSize(width: value.translation.width + self.NewPosition.width,
height: value.translation.height + self.NewPosition.height)
}
.onEnded { value in
self.Position = CGSize(width: value.translation.width + self.NewPosition.width,
height: value.translation.height + self.NewPosition.height)
self.NewPosition = self.Position
}
)
}
}
struct colom_Previews: PreviewProvider {
static var previews: some View {
colom()
}
}