gh-EmergeTools-Pow/Example/Pow Example/Examples/Transitions/SwooshExample.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

37 lines
813 B
Swift

import Pow
import SwiftUI
struct SwooshExample: View, Example {
@State
var isVisible: Bool = false
var body: some View {
ZStack {
if isVisible {
PlaceholderView()
.transition(.movingParts.swoosh.combined(with: .opacity))
}
}
.defaultBackground()
.onTapGesture {
let animation: Animation
if isVisible {
animation = .easeIn
} else {
animation = .spring()
}
withAnimation(animation) {
isVisible.toggle()
}
}
.autotoggle($isVisible, with: .spring())
}
static let localPath = LocalPath()
static var icon: Image? {
Image(systemName: "skew")
}
}