Skip to content

Commit

Permalink
Demo gesture in app
Browse files Browse the repository at this point in the history
  • Loading branch information
eLud committed May 30, 2024
1 parent d3766da commit 3a6daa4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions Projects/First contact/First contact/Views/AppStoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,30 @@ struct AppStoreView: View {
.padding(.bottom, 8)
}

@GestureState private var appIconRotation = Angle(degrees: 0)
@GestureState private var translation = CGSize.zero

private var appIcon: some View {
AppIconView(iconName: app.appIconName)
.frame(width: 128, height: 128)
.rotationEffect(appIconRotation)
.offset(translation)
.gesture(iconDragGesture)
.simultaneousGesture(iconRotationGesture)
}

private var iconRotationGesture: some Gesture {
RotateGesture()
.updating($appIconRotation) { value, rotation, transaction in
rotation = value.rotation
}
}

private var iconDragGesture: some Gesture {
DragGesture()
.updating($translation) { value, translation, transaction in
translation = value.translation
}
}

private var getAppButton: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ApplicationListView: View {
@Environment(AppData.self) var data: AppData

@State private var selectedApp: Application?
private var showAccount = true
@State private var showAccount = false
@State private var showAlert = false
@State private var showConfirmationDialog = false
@State private var showHomeMadeModal = false
Expand All @@ -35,7 +35,7 @@ struct ApplicationListView: View {
.sheet(item: $selectedApp) { app in
AppStoreView(app: app)
}
.sheet(isPresented: .constant(true), content: {
.sheet(isPresented: $showAccount, content: {
Text("Test")
.presentationDragIndicator(.visible)
// .presentationCornerRadius(50)
Expand Down

0 comments on commit 3a6daa4

Please sign in to comment.