Questions tagged [swiftui-animation]
228 questions
1
vote
1 answer
SwiftUI Nested transitions and animations
I have a horizontal ScrollView that holds some Rectangles. What I am trying to achieve is to fadeout each Rectangle and then hide (remove) the ScrollView.
I have partially achieve this:
I said partially because, as you can see, the Rectangles are…

Aнгел
- 1,361
- 3
- 17
- 32
0
votes
2 answers
SwiftUI swap 2 views's places (once replaces the other)
I have 2 views in SwiftUI in the HStack. I want to change their places, so 1. view jumps to 2. position and 2. to 1. position.
Here is some code example:
HStack {
Spacer()
LeftChannelView()
.offset(x: swapLeftToRight ?…

mackode
- 73
- 7
0
votes
0 answers
Glitchy animation on SwiftUI's contextMenu(menuItems:preview:)
I noticed there is always a glitchy animation the first time you run a context menu with a preview on SwiftUI. Subsequent triggers to the method work just fine, but the first one is really glitchy. Anybody else experiencing this? Tested on iOS 16.1…

Hamster
- 133
- 3
- 12
0
votes
1 answer
SwiftUI Chart Text Animation Glitch with AxisMarks and AxisLabels
I've encountered an animation glitch affecting the text for AxisMarks and AxisLabels in the SwiftUI Chart framework. Below are the sample project code and video for reference:
struct ContentView: View {
@State var isDisplayingAge = true
…

Dan Flict
- 117
- 8
0
votes
1 answer
How to duplicate the animation and transition of Safari Tabs?
I am creating an in-app browser and want to support multiple "tabs". As a starting point I have attempted to re-create the same UI/UX that safari has, a "grid" of "cards".
I am trying to figure out how to duplicate the smooth scaling transition when…

JimmyJammed
- 9,598
- 19
- 79
- 146
0
votes
2 answers
Why my animation doesn't work for a compass made in SwiftUI
I am making a simple compass view with just basic things for a view and I would like to have it animated. I am using the compass of my physical device (iPhone 13 PRO).
So, everything seems to be fine - heading is correct, view is rotating but... the…

bacata.borisov
- 17
- 5
0
votes
1 answer
SwiftUI update child view during transition
I have a situation that I have to update a child view within a view that is under an onging transition.
Here is a simple code to reproduce/demonstrate the issue I just mentioned.
struct ContentView: View {
@State var text =…

mrfour
- 1,128
- 12
- 21
0
votes
0 answers
SwiftUI animation stops working after toggle Settings->Accessibility->Display & Text Size->Button Shapes
I have a problem with SwiftUI animation of a Button label. The problem is that after I change the 'Button Shapes' accessibility setting from the iOS settings menu (Settings->Accessibility->Display & Text Size->Button Shapes), the animation stops…

ihmgsm
- 23
- 6
0
votes
1 answer
SwiftUI Animation finish animation cycle
I want to finish the loading animation nicely when changing the refreshing boolean in the following scenario:
public struct RefreshingView : View {
@State private var rotation = Angle(degrees: 0.0)
@Binding private var refreshing: Bool
…

Niklas
- 23,674
- 33
- 131
- 170
0
votes
1 answer
How to clamp a SwiftUI spring animation for a smooth "snap" after releasing a DragGesture?
I have a view that I want to drag across the screen using a DragGesture. When the gesture ends, I want the view to seamlessly animate (snap) to a fixed position. Additionally the view should be clamped to the edges of the screen, and not translate…

jamesrogers93
- 335
- 1
- 5
- 15
0
votes
0 answers
How to update UIHostingViewContoller View Layout on SwiftUI Body update
I am embedding SwiftUI View inside a HostingViewController and added the hosting viewcontroller view on ViewController subview. Initially the size of SwiftUI view is calculated by intrinsic content size of Text in it. But when the Text inside the…

MUKUL BAKSHI
- 11
- 1
- 1
0
votes
1 answer
How to animate a swiftUI button to display another view
I have a quite simple case, a view displays another one when a button is pressed.
The label on the second view is at the top of the view, which is working fine, unless I try to animate the button when it's pressed. In that case the label on the…

Eric
- 592
- 10
- 26
0
votes
1 answer
Animate SwiftUI list containing buttons
In SwiftUI, if I add a Button to a List, the List no longer animates when the collection changes. How can I make it animate?
Here's a reproduction. In the code's current form, animation works when the list is shuffled. However, if I replace Text…

Edward Brey
- 40,302
- 20
- 199
- 253
0
votes
1 answer
Use dismiss() to pop view from NavigationStack with different animation
I am using the @Environment(.dismiss) private var dismiss and than dismiss() to pop current view from NavigationStack. In my app it should look like going forward however, rather than backwards.
When I use dismiss() the animation is sliding from…

Pawel Swiderski
- 3
- 1
0
votes
0 answers
SwiftUI Button animation
I use ButtonStyle, for button style. But when I updated button from enable to disable, and change thread, the button change without animation.
//I have ButtonStyle:
struct WizardButtonStyle: ButtonStyle {
enum Style { case enabled, disabled }
…

Medoed
- 1
- 3