Questions tagged [swiftui-animation]

228 questions
1
vote
0 answers

matchedGeometryEffect does not work for same object on different tab views

I was working on an app store mock up project and I was trying to implement the "Hero" Animation. At first the matchedGeometryEffect was working fine for the home page. Ideal Effect However on another tab view, when the same picture was show in…
GeekNomore
  • 13
  • 4
1
vote
1 answer

SwiftUI: Animate LazyVGrid layout change when window is resized

In a MacOS app, I have a LazyVGrid. As we resize the window width, it adapts the layout, i.e. rearranges its items. I would like to animate these layout changes. Afaik the recommended ways are withAnimation and .animation(Animation?, value:…
bzyr
  • 289
  • 1
  • 11
1
vote
1 answer

SwiftUI animation: move up/down on press, spring on release - how to do the "move up" part

How can I get the blue circles to first move away from the green circle before getting back to it? The animation should be: press and hold: the green circle scales down the blue circles, while scaling down as well, first move "up" (away from their…
Arnaud
  • 17,268
  • 9
  • 65
  • 83
1
vote
1 answer

Adding animation to TabViews in SwiftUI when switching between tabs

The question might look familiar, but I went through all solutions on this topic but none had a working approach for the latest versions of SwiftUI and iOS. So here is my tab view, I am trying to animate when switching between the tabs. I tried…
1
vote
1 answer

SwiftUI Animate Custom Progress Bar

I created this custom progress view with bars for the progress, how can I animate the the green color in the next bar when it's time to go to the next element? I am looking for it to fill the bar slowly from left to right struct ContentView: View { …
tHatpart
  • 1,302
  • 3
  • 12
  • 27
1
vote
2 answers

Disable SwiftUI frame animation on appear

The Goal Let's say I have a List or a LazyVGrid that displays multiple items nested inside a ScrollView. I use a ForEach view to generate the individual item views: ForEach(items) { item in ItemView(item) } The items array might be a @State…
Mischa
  • 15,816
  • 8
  • 59
  • 117
1
vote
1 answer

SwiftUI: 'value' parameter not working as expected in iOS 15's new animation method signature

I'm trying to solve the iOS 15's warning: 'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead. in a view that appears on top of screen that looks like push notification alert (or what so called snack bar), but…
JAHelia
  • 6,934
  • 17
  • 74
  • 134
1
vote
0 answers

Animation not working when pass single object to the view in SwiftUI

I have a rather strange problem with animation on adding elements to list in SwiftUI. I have a simple model class: struct ShoppingList: Identifiable, Equatable { let id: UUID var name: String var icon: String var items: [Item] …
ostojan
  • 608
  • 1
  • 7
  • 17
1
vote
1 answer

Multiple View transition animations not happening at once

Very early into SwiftUI programming, I am basically trying to show a list of cards inside a container view, with the top most one being shown... Each card has a text view and when tapped the card view is removed from the stack/container view and the…
Prasad
  • 166
  • 7
1
vote
1 answer

How to fix Rectangle to it's position to prevent it from randomly flying around the screen after rotation of device?

I need to have working rotation animation and the rectangle on the same relative position after changing orientation. Right now the rectangle starts randomly fly around the screen after change orientation of device. import SwiftUI struct…
1
vote
1 answer

Binding variable from an ObservableObject cannot produce animation when changing the value

I have a List view created from an integer array called data and use binding to pass the data to the view. I am using withAnimation when appending elements to the data array. If the property wrapper of data is @State, shown below, then the animation…
F5Soft
  • 11
  • 1
1
vote
0 answers

SwiftUI .matchedGeometryEffect in List not working

I am trying to animate an image to full screen from a row in a list and then animate back when I dismiss it. I am trying .matchedGeometryEffect but there are two big problems. Firstly there is no animation when dismissing. Secondly, if you first…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
1 answer

SwiftUI Strange Animation Transitioning via NavigationLink to a new View?

I'm experiencing a strange animation behavior when transitioning from any item in the List of InsightsHomeView to InsightsCard Any idea what could cause this or how to fix? //Navigating from this view: struct InsightsHomeView: View { var…
GarySabo
  • 5,806
  • 5
  • 49
  • 124
1
vote
0 answers

what happens when using withAnimation without specifying DispatchQueue

struct MyShimmer: View { @State var show = false var body: some View { ZStack { Color.black VStack { ZStack { Text("Chao") …
Chao Huang
  • 13
  • 3
1
vote
1 answer

SwiftUI Animations in the same view are displayed differently

In the first section there is no problem, but in the second section there is a problem in my animation. using the same view in the first section and the second section. In the second section, the text shifts to the right and left. But I don't want…
Ufuk Köşker
  • 1,288
  • 8
  • 29