270 questions
0
votes
1
answer
71
views
Custom bottom sheet shows brief flicker/fade of underlying view when expanding/collapsing (iOS 15)
I’m building a reusable custom bottom sheet component in SwiftUI because my app supports iOS 15, so I can’t use .sheet with detents yet. Functionally everything works the sheet opens and closes but I’...
0
votes
2
answers
86
views
Prevent matchedGeometryEffect from animating during transition
I am trying to present a modal that contains an element using matchedGeometryEffect. I’ve run into a problem — if I animate the transition, the matchedGeometryEffect animates as well. I’d like it not ...
0
votes
0
answers
44
views
List animations broken in macOS Sequoia but work in Sonoma (FetchRequest, Picker filters)
In macOS Sonoma, my SwiftUI code performs smooth, expected animations when List contents change — both when using @FetchRequest with a changing predicate and when filtering manually via Picker ...
0
votes
0
answers
17
views
Concurrent animations in SwiftUI [duplicate]
I have a view that can be in two different positions depending on the state of the rest of the app.
The same view can contain either two or three buttons depending on some state that is determined ...
1
vote
1
answer
101
views
SwiftUI PhaseAnimator make a view jitter in sheet presentation
First here's a block of code that reproduce the issue:
import SwiftUI
struct CustomAnimation: ViewModifier {
@State private var isAnimated: Bool = false
func body(content: Content) -> ...
0
votes
1
answer
119
views
Animating items in a SwiftUI list only at first appearance
I have a simple SwiftData app. Whenever ImageLibraryView appeared, there were microhangs because images inside each ThumbnailView were being loaded synchronously.
So I solved that by loading the ...
0
votes
0
answers
44
views
Append item in list with slide animation
I have one view named CongratulationOverlay, and in bottom there is one horizontal list. Now I want that overlay view to slide in to the horizontal list as I am appending that into list. and ...
-3
votes
1
answer
98
views
How to animate substring in a Text?
Currently, I am using multiple Texts in a horizontal stackview, to achieve animation of substring.
As you can see in the above animation, the text
- conversation
- meeting
- lecture
are animated.
...
2
votes
2
answers
106
views
MatchGeometryEffect not work properly while return come back to start position
I am working on geometryMatchEffect and struggled on one point. In my case, when tap on a item, the item should be fly to page of the top and other items should remain backside. And then when tap on ...
0
votes
0
answers
162
views
How does one animate an annotation on a SwiftUI Mapkit Map?
I'm attempting to animate an array of annotations on a SwiftUI MapKit Map and not getting the behavior I'm expecting. I see lots of examples on how to animate the map camera, etc, and even a few on ...
0
votes
1
answer
149
views
How to create complex series of animation in SwiftUI
How can "complex" animations be composed in SwiftUI? Where complex means that the complete animation is composed out of multiple sub-animation.
Example
I am working on migrating an existing ...
-1
votes
1
answer
156
views
SwiftUI animation - Understanding how state changes are handled / animated
I am struggeling to understand how exactly SwiftUI animates view changes in a concrete example I am working on.
TL;DR The description of the problem and the code is quite long. The basic question is: ...
0
votes
2
answers
119
views
Is it possible use animation properties (current value, speed) of withAnimation block to change other values?
The simple code below moves the text by updating the @State var offset within a withAnimation block.
struct ContentView: View {
@State var offset: CGFloat = 0
var body: some View {
...
1
vote
0
answers
126
views
How can I make the legend of a pie chart remain static during the chart’s animation when using 'sectormark'
I was trying to make the animation of a pie chart, I was trying to make the appear layout animation. (As the user navigates to the page, the pie chart will animate, starting from the 12 o'clock ...
1
vote
1
answer
880
views
Issue with .animation in SwiftUI causing the entire view to move
I am having an issue after updating to Xcode 15 where my view unexpectedly moves when trying to animate a rotating Circle() in SwiftUI. Previously, this code worked perfectly, but now the entire view ...
0
votes
0
answers
32
views
I'm trying to add animation to the buttons that were not tapped [duplicate]
Is a game selection with 3 different options per round. I added an animation to the button selected. But I'm trying to add an animation for the buttons that are not selected. I'm new to Swift and ...
1
vote
1
answer
592
views
How can I animate programmatically scrolling to a specific x point in SwiftUI Charts
Hey I'm using the new SwiftUI Charts to display a graph to display a line graph for a user's weight. The issue that I am running into specifically is trying to animate the scroll position of the ...
1
vote
1
answer
48
views
Mutating reference type doesn't work with .animation(_:value:)
How can I animate changes to a view when the value being mutated is a reference type?
In the example below, changing the reminder time updates the order but without animation.
I thought arrays were ...
0
votes
1
answer
117
views
SwiftUI Animation in Tabbar
I am wanting to animate switching between tabs but the animation are very hard. I tried using matched geometry but the animation was wacky. Could be lack of understanding on matched geometry.
The ...
0
votes
2
answers
1k
views
SwiftUI Animation: How do I customize the transition animation (fade out THEN fade in)
This code would produce an animation that crossfades the values whenever I change self.myTextString:
// In some View's body method
Text(self.myTextString)
.transition(.opacity)
.animation(.easeInOut(...
0
votes
0
answers
386
views
Animating Text() Across screens with Matched Geometry Effect
I'm trying to have a matched geometry effect where a Text() is being animated across two different screens/views. I want the animation to continuously interpolate the texts size between the source ...
0
votes
1
answer
723
views
Animation problem when using Namespace and MatchedGeometryEffect
I've caught a very strange problem (THAT ONLY OCCURS ON REAL DEVICES) that has to do with using @NameSpace and MatchedGeometryEffect using NavigationStack. The problem is that if I go from the first ...
0
votes
1
answer
72
views
Can you defer evaluation of a variable used in a view removal transition?
I've got a parent view that presents one of a couple of views, depending on the value of an observed variable.
In the simple example below, RainbowView is presented when the @Published variable "...
0
votes
1
answer
154
views
How to animate this in SwiftUI?
I am new to iOS development and I have been working on a project using SwiftUI. I have a sheet where I can buy or sell some stocks. On successful transaction, I am supposed to show a green screen with ...
0
votes
1
answer
64
views
How to use a transition when iterating over an array?
I would like to have a transition when the I'm iterating through the index of an array. I would like to display several notifications, and after 7.5 seconds I want to display the new one with a ...
1
vote
1
answer
405
views
Adding items to ForEach and animate the items below nicely so it doesn't jump
I'm trying to get this to animate nicely when I add elements to my array.
Currently the button jumps down after the foreach elements are added.
Here's my code:
import SwiftUI
class ...
1
vote
0
answers
84
views
Overwrite Transition from outside in SwiftUI
I have a badge component with a built-in transition:
public struct BadgeView: View {
...
public var body: some View {
Text(stringValue)
.background(.red)
....
2
votes
2
answers
116
views
Selectively apply implicit/.animation-modifier-based animations
Given the following example that uses explicit animations (withAnimation) to change the size of a rect (animated) and its color (not animated):
struct ContentView: View {
@State var size: ...
3
votes
0
answers
79
views
Offset modifier not working when used inside a scoped animation in SwiftUI
The target view has .opacity() and .offset() modifiers in a scoped animation (iOS 17):
Text("Hello, world!")
.animation(.default) {
$0
.opacity(animate ? 1 : 0.2)
...
1
vote
1
answer
452
views
SwiftUI symbol effects animate on scrolling list only when in Stack view
When: Embedding a Image with a symbol effect in a stack view in SwiftUI, and putting this in a List
Actual: The symbols animate when scrolling that item in and out of the view
Expected: The symbol ...
0
votes
1
answer
350
views
Animation delay causes animation to be out of sync with the view layout in SwiftUI
Using a delayed animation on an HStack causes the animation to become out of sync with the view layout. This looks like very simple SwiftUI code.
Without the animation .delay(), everything works fine.
...
0
votes
1
answer
142
views
SwiftUI trajectory transition animation
I am struggling with the animation of views when inserting them into a stack. In general, I am trying to create an effect where cards fly out from the stack and move to their final destination. I have ...
2
votes
0
answers
145
views
SwiftUI LazyVGrid: Expanding view causes LazyVGrid animation bug
Expanding a SwiftUI View causes the LazyVGrid to remove all the items that will not be seen when the animation is completed. Additionally, when scrolling down the items animate from their original ...
0
votes
2
answers
1k
views
SwiftUI .matchGeometryEffect not working smoothly
I've been trying for sometime now to figure out why the .matchGeometryEffect is not transitioning smoothly in my use case. The state change speed is not consistent, growing quicker and going back ...
2
votes
1
answer
127
views
Use matchedGeometryEffect to create 'slide' effect for border
I'm trying to create a custom 'tab' selection control with a horizontal row of options and the user can select one of N number of options. The 'selected' option will have a 'border' around it. Here's ...
2
votes
2
answers
2k
views
How to simultaneously perform multiple animations to one element in SwiftUI?
I have a WaveView which is just a sine wave and a rectangle. To make it act like a real wave, I need it to translate unstoppably. So I wrote a Wave view and added an animation on offset with a timer ...
1
vote
2
answers
554
views
Determining SwiftUI Sheet Presentation Animation Completion
I would like to find out when the sheet presentation animation concludes in SwiftUI. While in UIKit, this is easily achieved with the present(_:animated:completion:) function. The completion block in ...
1
vote
1
answer
638
views
SwiftUI Animation Issue ForEach
Today I faced an issue with animations depending on which kind of ForEach I use. To be honest I don’t understand what exactly the issue is.
I created this little example for you.
The AudioIndicators ...
2
votes
2
answers
548
views
SwiftUI opacity transition fades each views and subviews separately
TLDR: how to render a whole subview before fading it in?
Consider this code snippet: a simple white view and a button that toggles an overlaying FrontView. The FrontView is a superposition of 2 black ...
1
vote
1
answer
198
views
How to use frame animation similar to UIKIT in swiftUI
I'm just using swiftUI.
I want some one view to have a repeating animation: 1.move up, 2.pause, 3.move up, 4.pause, 5.move down, 6.pause, 7.move down, 8.pause.
Similar to the undulations of pixel wind ...
2
votes
0
answers
541
views
Unwanted Crossfade Effect in SwiftUI's Matched Geometry Effect
In SwiftUI, I'm working with two screens, Screen A and Screen B. I'm attempting to create a transition effect using SwiftUI's matched geometry feature. The transition involves two rounded rectangles: ...
1
vote
2
answers
5k
views
My Animation in SwiftUI is not working properly
I have a problem with animation in SwiftUI, if I'm using .animation, my animation is not working.
ZStack(alignment: .bottom) {
VStack {
Button("Button") {
showView....
0
votes
0
answers
111
views
SwiftUI transition not working properly when it contains LazyVGrid
I want a view to come in from the right when pressing a component. The issue is that the Vstack that contains the LazyVGrid slides into the screen after the LazyVGrid components appear (w/o a ...
5
votes
1
answer
841
views
SwiftUI Sheet Animation Issue with Non-Default Background Colors
I'm working on a SwiftUI project where I use a .sheet modifier to present a bottom drawer with two detent sizes: .medium and .large. The drawer contains a button that toggles its size between these ...
2
votes
1
answer
484
views
Managing side-effects when SwiftUI's onDisappear not called immediately due to page transition animation
I have a theoretical question about SwiftUI, the timing of the onDisappear() method, and view transitions.
Lets say you have a navigation setup like this:
enum ScreenToShow {
case main, editting, ...
0
votes
1
answer
924
views
How can I update view when ScrollView scrolling in SwiftUI
I'm new to SwiftUI and I'm trying to update the view while ScrollView is scrolling. As I scroll the screen, I want to increase the size of the image in the middle by 1.2, increase the visibility of ...
0
votes
1
answer
220
views
Memory leak in iOS 17 in AnimatableModifier
I'm facing a memory leak problem in iOS 17, in earlier versions it works fine:
import SwiftUI
struct SkeletonModifier: ViewModifier {
@State private var phase: CGFloat = 0
let animation: ...
0
votes
1
answer
286
views
How to alter a button's label animations from multiple view in my project?
I have a SwiftUI button in one of my views. For the label I use two different SF Symbols with different colors and animations based on the value of a var "gpsIsActive"
Here is a video:
The ...
1
vote
0
answers
58
views
Does SwiftUI have/need an equivalent to Flutter's ticker with vsync?
Lets say we're using SwiftUI and we are using a timer to fire X times per second.
Every time the timer callback fires, we update a @State variable that triggers a view update with the new value.
Lets ...
1
vote
1
answer
183
views
How can i get animation when click a button that in List?
My code is like this:
List {
Button(action: {}, label: {
Text("Button")
})
Button(action: {}, label: {
Text("...