Questions tagged [swiftui-animation]
228 questions
2
votes
1 answer
Fade-in/out animation with a boolean flag
I am trying to implement a simple "tap to toggle the visibility of the UI" in SwiftUI with fade in/out animation. The following code animates the fade-in effect of the Text element as I expected, but it immediately hides the Text element when…

Satoshi Nakajima
- 1,863
- 18
- 29
2
votes
0 answers
Transition on parent view overrides animation in a child view (Button)
I have the following view I place inside a button's label:
struct ButtonLoading: View {
@Binding var isAnimating: Bool
var body: some View {
HStack(spacing: 4) {
CircleView(isAnimating: $isAnimating, idx: 0)
…

Russ d'Sa
- 93
- 4
2
votes
2 answers
SwiftUI: Textfield shake animation when input is not valid
I want to create a shake animation when the User presses the "save"-button and the input is not valid. My first approach is this (to simplify I removed the modifiers and not for this case relevant attributes):
View:
struct CreateDeckView: View {
…

kirkyoyx
- 313
- 2
- 12
2
votes
2 answers
Why the text appear at loading with animation?
I want to hide some text behind the NavigationBarTitle and show it when user press a button, it's working fine. The only problem is with the animation. At loading we see the text moving behind the NavigationBarTitle and that's not what i want.
How…

Flincorp
- 751
- 9
- 22
2
votes
1 answer
SwiftUI: How to run another animation after the first one completes?
I am new to SwiftUI (and the whole iOS Development in general). I learned that to animate a view in SwiftUI you can do:
MyView()
.scaleEffect(scaleValue)
.onAppear {
scaleValue = anotherValue
}
.animation(.spring())
But I…

Archie G. Quiñones
- 11,638
- 18
- 65
- 107
2
votes
1 answer
How to animate hideable views with SwiftUI?
I'm trying out SwiftUI, and while I've found many of its features very elegant, I've had trouble with animations and transitions. Currently, I have something like
if shouldShowText {…

Etan Ossip
- 33
- 5
2
votes
0 answers
How does rotation3dEffect in SwiftUI work?
How do x, y and z arguments define an axis in the rotation3DEffect ?
Since the documentation doesn't explain anything, I've found this on Hacking With Swift by Paul Hudson.
It says
If you’ve never done 3D rotation before you should think about the…

Tilak Madichetti
- 4,110
- 5
- 34
- 52
1
vote
0 answers
Animating text change and placement at once in ForEach clause
I have an array that holds some data, that is changing by a button click.
One of the properties of that data is a number.
I want to make a view that will show the numbers in the array and with every button click, they will be resorted by the new…

avivmg
- 369
- 3
- 7
1
vote
3 answers
SwiftUI - ScrollViewProxy scrollTo Animation Disappear in iOS 17
In the following code snippet, I use proxy.scrollTo() to scroll to a target. In order to animate the scrolling process, I wrapped this function call inside withAnimation. This code works on iOS 16, but not on iOS 17. In iOS 17, it does scroll, but…

wheatset
- 339
- 1
- 7
1
vote
1 answer
Ripple Effect animation SwiftUI
I am attempting to create a ripple effect on a button, but the animated circles are going below the button, and the ZStack is not functioning as expected.
Expected Result
I want the outer two circles to be continuously going out of the central dark…
1
vote
2 answers
How do I get the background in swiftui to scale to fit the whole screen
I'm still pretty new to swift UI, almost finished a project however no matter what I try I cannot get the background to take up the whole screen space, with the code below it still has a white border surrounding the image on all sides, I've tried…

molly0404
- 21
- 1
1
vote
0 answers
How to make this Swiftui List animation more fluid?
I'm creating a view and would like to show cells being filled after view appear.
here is the code:
import SwiftUI
struct AnimatedListView: View {
@State private var items: [String] = []
var body: some View {
List {
…

Sebastian
- 6,154
- 5
- 33
- 51
1
vote
1 answer
How to make this typewriter animation smoother and less blurry?
I'm creating this animation and would like to know if there is a way to make it more enjoyable.
here is the code:
import SwiftUI
struct TypewriterView: View {
let text: String
@State private var animatedText = ""
var body: some View…

Sebastian
- 6,154
- 5
- 33
- 51
1
vote
1 answer
How to keep the same identity for transition animation in SwiftUI
I'm trying to achieve a smooth transition between 2 states of a SwiftUI view. The following code works great, when the offset changes, SwiftUI interpret that as 2 states of the same view (same identity), and transition with a slide of the…

Damien
- 3,322
- 3
- 19
- 29
1
vote
1 answer
SwiftUI - Change Row Colors When Moving One Row
I'm building a reorderable List in SwiftUI. It has been straightforward for the most part (using the onMove closure to update the datasource). However, I'm running into issues understanding how to detect when a user starts and ends moving an item.…

Andrew
- 815
- 2
- 13
- 33