HomeiOS Developmentswift - How do I take advantage of animations after the iOS...

swift – How do I take advantage of animations after the iOS 17 replace?


After updating to iOS 17, a .animation I take advantage of all through my challenge has modified and now it appears to be like dangerous.

When utilizing it I had a warning that stated:

‘animation’ was deprecated in iOS 15.0: Use withAnimation or animation(_:worth:) as an alternative.

This message did not appear to impact the way it seemed when the code ran however now I feel it’s impacting it now.

Right here is my code:

TabView(choice: $selectedCategory) {
                                
                                View1()
                                    .tag(Class.view1)
                                    .onAppear {
                                    }
                                    .animation(.default)
                                
                                ImageView()
                                    .padding(.high)
                                    .tag(Class.imageView)
                                    .onAppear {
                                    }
                                    .animation(.default)
                                
                                View3()
                                    .tag(Class.view3)
                                    .onAppear {
                                    }
                                    .animation(.default)
                            }

The default animation occurred when the views within the tab view had been initialised. This nonetheless occurs however as an alternative of a pleasant pure fade in, it appears to be like messy.

What do I would like to switch .animation(.default) with in an effort to return to a pleasant delicate fade in impact?

I attempted to present the animation a boolean worth that was set to true within the .onAppear however this did not appear to work.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments