Created
August 6, 2024 09:44
-
-
Save Obbut/dbaa947514625990495808b6d77f4cdb to your computer and use it in GitHub Desktop.
SwiftUI Animatable zIndex modifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileprivate struct AnimatableZIndexModifier: ViewModifier, Animatable { | |
var animatableData: CGFloat | |
func body(content: Content) -> some View { | |
content.zIndex(animatableData) | |
} | |
} | |
extension View { | |
func animatableZIndex(_ zIndex: CGFloat) -> some View { | |
modifier(AnimatableZIndexModifier(animatableData: zIndex)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment