Skip to content

Instantly share code, notes, and snippets.

@muhammadabbas001
Created November 19, 2023 17:25
Show Gist options
  • Save muhammadabbas001/9887628a14f044a3b63f97fc033eace7 to your computer and use it in GitHub Desktop.
Save muhammadabbas001/9887628a14f044a3b63f97fc033eace7 to your computer and use it in GitHub Desktop.
import SwiftUI
enum DragState {
case inactive
case dragging(translation: CGSize)
var translation: CGSize {
switch self {
case .inactive:
return .zero
case .dragging(let translation):
return translation
}
}
var isDragging: Bool {
switch self {
case .inactive:
return false
case .dragging:
return true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment