gh-EmergeTools-Pow/Example/Pow Example/Examples/Conditional Effects/PushDownExample.swift
Joe Fabisevich 781d455727
Moving Pow to @emergetools
Co-authored-by: Robert Böhnke <robb@robb.is>
Co-authored-by: Kasper Lahti <kasper@lahti.email>
2023-11-29 09:38:34 -05:00

45 lines
1.1 KiB
Swift

import Pow
import SwiftUI
struct PushDownExample: View, Example {
@State
var isPressed: Bool = false
var body: some View {
VStack {
Spacer()
Text("Push me")
.font(.system(.title, design: .rounded, weight: .semibold))
.blendMode(.destinationOut)
.padding()
.frame(maxWidth: .infinity)
.background(Color.accentColor.gradient, in: Capsule(style: .continuous))
._onButtonGesture {
isPressed = $0
} perform: {
}
.conditionalEffect(.pushDown, condition: isPressed)
.compositingGroup()
.padding()
Spacer()
}
.defaultBackground()
}
static var description: some View {
Text("""
Scales the view down as if pushed wile a condition is met.
""")
}
static let localPath = LocalPath()
static var icon: Image? {
Image(systemName: "arrow.down.to.line.compact")
}
static var newIn0_3_0: Bool { true }
}