Extended Piped support

This commit is contained in:
Arkadiusz Fal
2021-10-21 00:21:50 +02:00
parent 2d075e7b3a
commit c3326a56af
46 changed files with 706 additions and 458 deletions

View File

@@ -0,0 +1,9 @@
//
// GestureTimer.swift
// SwiftUIKit
//
// Created by Daniel Saidi on 2021-02-17.
// Copyright © 2021 Daniel Saidi. All rights reserved.
//
import Foundation

View File

@@ -0,0 +1,22 @@
import SwiftUI
extension View {
func onSwipeGesture(
up: @escaping () -> Void = {},
down: @escaping () -> Void = {}
) -> some View {
gesture(
DragGesture(minimumDistance: 10)
.onEnded { gesture in
let translation = gesture.translation
if abs(translation.height) > 100_000 {
return
}
let isUp = translation.height < 0
isUp ? up() : down()
}
)
}
}