Questions tagged [swiftui-animation]

228 questions
4
votes
0 answers

SwiftUI: LazyVGrid not refreshing while scrolling

I have a LazyVGrid that displays search results, as I type characters in the search field, I perform CoreData fetch requests and update a @Published property. Problem: LazyVGrid updates results as expected EXCEPT if it is currently scrolling: in…
4
votes
1 answer

Dynamic transitions in SwiftUI

I want to be able to use a different transition depending on the state transition. For example, if I go from .one => .three, I want to fade out ViewOne on removal. If I go from .one => .two, I want to move ViewOne to the left on removal. Right now I…
Russ d'Sa
  • 93
  • 4
4
votes
1 answer

Animation transition of one gradient to another SwiftUI

I was trying to change the gradient of a background depending on the value of a state value which should be possible, and it is. However, I wanted to animate this change of gradient/background (as you often do when a property depends on some…
Evan
  • 1,892
  • 2
  • 19
  • 40
4
votes
1 answer

Why SwiftUI-transition does not work as expected when I use it in UIHostingController?

I'm trying to get a nice transition for a view that needs to display date. I give an ID to the view so that SwiftUI knows that it's a new label and animates it with transition. Here's the condensed version without formatters and styling and with…
muvaaa
  • 450
  • 4
  • 12
4
votes
1 answer

SwiftUI Chaning Animations

I am trying to chain two animations in SwiftUI. However, the first animation does not animate when pressing the button. I found this approach of chaining animations here: Chaining animations in SwiftUI struct FancyButtonViewModel: View { @State…
simibac
  • 7,672
  • 3
  • 36
  • 48
4
votes
0 answers

Chaining SwiftUI withAnimation delays - only last animation displayed unless the object is mid-animation where all animations are displayed

It appears that in another question, someone gave a solution that you could chain withAnimations together. It makes sense to me so I tried it and it almost works. While the object is not in motion, only the very last animation is displayed. …
4
votes
4 answers

How can I customise the Animation of an Angle change in SwiftUI

I have an app that shows a bunch of people who each have an origin and angle. struct Location { var centre:CGPoint var facing:Angle } SwiftUI magically and automatically does a lot of the animation as they move from location A to location…
Confused Vorlon
  • 9,659
  • 3
  • 46
  • 49
3
votes
0 answers

How to know when SwiftUI presentation has finished?

I want to know when my SwiftUI view has finished it's transition/animation in order to safely present additional views/modals. Example: I am in View A showing Sheet A. Within Sheet A I tap a button that dismisses Sheet A, transitions from View A to…
3
votes
1 answer

SwiftUI animation issue

I'm creating a flashcard view for language education. The first iteration consisted of flipping cards to front and back. The second iteration consisted of an addition of a swipe-based interface. The third iteration was meant to combine the previous…
3
votes
3 answers

SwiftUI Animation from screen bottom not working properly

I'm trying to create an animation of a View coming into the screen from the bottom. But in the very first time it only appears on screen without any animation and then it starts work properly. This is the code: struct ContentView: View { @State…
Sebastian
  • 6,154
  • 5
  • 33
  • 51
3
votes
3 answers

SwiftUI Matched Geometry Effect not working with multiple ForEach's

I am basically trying to recreate the photos app. In doing so, matched geometry effect should be the best way to recreate the animation that is used in the photos app when you click on an image/close it. However, on opening of an image it only does…
Trevor
  • 580
  • 5
  • 16
3
votes
2 answers

How to clip a view while using a SwiftUI .move transition / animation

I'm trying to animate in a view and make it appear as if it's a sort of drawer opening from another view. This is all fine except if the first view is not opaque. It appears that you can see the animating view the moment it begins animating. Is…
LLooggaann
  • 425
  • 1
  • 4
  • 16
3
votes
1 answer

SwiftUI Circle View animation glitch

import SwiftUI struct CircularProgressView: View { @Binding var progress: Float private let strokeStyle = StrokeStyle(lineWidth: 30.0, lineCap: .round, lineJoin: .round) private let rotation = Angle(degrees: 270.0) …
GuilhE
  • 11,591
  • 16
  • 75
  • 116
3
votes
1 answer

Delay SwiftUI combined transitions

With the following code, the intention is to have the transition fading in (opacity) and shifting downwards (offset) at the same time but with a delay of .3 seconds. With this one only the opacity transition is visible after 0.3…
Leo
  • 1,508
  • 13
  • 27
3
votes
1 answer

Prevent SwiftUI animation from overriding nested withAnimation block

I have a screen with a draggable component (the "Springy" text) that springs back when released with a very prominent spring animation. There is some text that comes in asynchronously (in this example, using a Timer), and I want that to fade in…
gohnjanotis
  • 6,513
  • 6
  • 37
  • 57
1
2
3
15 16