Questions tagged [swiftui-animation]

228 questions
1
vote
1 answer

SwiftUI: Unexpected Animation when using a non @State var

I need some help. I created the following reusable view, let's call it MyCustomCapsuleView: Nothing special, just a Text with a Capsule in the background. This view will have a different look when the user turns it on. When the user turns it on,…
Aнгел
  • 1,361
  • 3
  • 17
  • 32
1
vote
2 answers

SwiftUI .onAppear withAnimation speeds up each time the view appears. Why?

I have on-going animations in my app that are triggered on onAppear and configured using withAnimation, updating a @State property. Each time the view appears, the animation runs a little faster than before, so if the view is displayed, then covered…
AVS
  • 373
  • 3
  • 19
1
vote
0 answers

SwiftUI: Text animation not working from the second line

I am trying to make sure I have a consistent animation throughout this dynamic Text view as I'm typing in the TextField. import SwiftUI struct ContentView: View { @ObservedObject var viewModel = ContentViewModel() var body: some View…
Miki
  • 329
  • 4
  • 10
1
vote
0 answers

Spring animation in SwiftUI, IOS14 is broken

struct ContentView: View { @State var search: String = "" let data = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen",…
Roma
  • 11
  • 1
1
vote
2 answers

SwiftUI: Animate Transitions

How can I animate slide transitions between different views? In following sample code I made a Picker that chooses which view to show and my goal is to have a transition that looks similar to the NavigationLink transition. At the moment it doesn't…
Isaak
  • 1,107
  • 2
  • 11
  • 29
1
vote
0 answers

How can I control the animation of a new row in SwiftUI List?

I have an inverted list in a chat application. When a new row is added, the default animation is almost like a curtain coming up to reveal the new row. The new row seems to appear from bottom to top. What I want though is the opposite. I want it…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
0 answers

SwiftUI: how to remove animation on NavigationLink

Is there a way to remove the animation in NavigationLink ? That would be particularly useful when using deep-linking/programmatic-navigation, via the isActive binding. Displaying the animation is that case feels inappropriate.
1
vote
0 answers

Animate view in from offscreen (bottom)

ok, I'm stumped with swiftui animations. I get the basics (I think) but how does one get a view to animate / transition in from the absolute bottom of the screen into it's final position - I can't seem to get this ... I've experimented with offset…
user1465078
1
vote
2 answers

SwiftUI button withAnimation + transition issue when background color in on the window

Dear SwiftUI community, I'm trying to creating a text field that toggles show/hidden with a move up/down animation on the clicking of a button. I found this helpful source on how to make this. However, when I tried it on my own code it only worked…
Paul
  • 23
  • 5
1
vote
1 answer

How to create an SwiftUI animation effect from the Model?

I have a model object, which has a published property displayMode, which is updated asynchronously via events from the server. class RoomState: NSObject, ObservableObject { public enum DisplayMode: Int { case modeA = 0 case…
Satoshi Nakajima
  • 1,863
  • 18
  • 29
1
vote
1 answer

Single Up/Down Animation on SwiftUI

I'm trying to make an animation where the coin flips and moves up then back down and stops after button click. With this code it moves up and down, but then snaps to the top position after the animation finishes. I know it must be because of the…
NikkoNikkoNii
  • 149
  • 1
  • 7
1
vote
1 answer

Animating showing/hiding of children a VStack in SwiftUI

** EDIT ** Suspect the UIKit view that this SwiftUI view is embedded in (via UIHostingController) is the problem, as @eXcore's solution works for me in preview. This is the UIKit layout code: var searchBox: UIHostingController =…
JamieNewman
  • 917
  • 1
  • 12
  • 20
1
vote
1 answer

SwiftUI animated view weird transition when appears inside ZStack

I have a problem regarding behavior of an animated loading view. The loading view shows up while the network call. I have an isLoading @Published var inside my viewModel and the ActivityIndicator is shown inside a ZStack in my view. The…
Adrian Macarenco
  • 165
  • 2
  • 11
1
vote
0 answers

How can i remove the trailing red animation at the end of swipe deleting using .onDelete swiftUI

This is the code : struct ContentView: View { @State var names = ["A" , "B", "C", "D"] var body: some View { List { ForEach(names, id: \.self ) { name in Group { testStruct(name: name) …
1
vote
0 answers

SwiftUI: Insertion transition animation not executed

In the following simple app, I expect the red rectangle to appear with scale animation and disappear with the slide animation but only the disappear animation is executed. Why is that? struct ContentView: View { @State private var showDetails =…
Isaak
  • 1,107
  • 2
  • 11
  • 29