Tuesday, April 21, 2026
HomeiOS Developmentios - How you can scroll mechanically when merchandise seems in SwiftUI?

ios – How you can scroll mechanically when merchandise seems in SwiftUI?

[ad_1]

I’ve a listing of numbers that seem vertically due to an animation, I want to have auto-scroll when a brand new quantity seems however i do not know the best way to go on…I noticed some questions like this however all of them had been a ‘leap to a quantity’ resolution, not progressively scroll…any strategies?

enter image description here

My Code:
struct ContentView: View {
    @State personal var animating = false
    
    var physique: some View {
        VStack {
            ScrollView(showsIndicators: false) {
                ForEach(0..<51, id: .self) { index in
                    Textual content("(index)")
                        .opacity(animating ? 1 : 0)
                        .animation(.easeIn(period: 0.5).delay(Double(index)), worth: animating)
                }
            }
        }
        .onAppear {
            animating.toggle()
        }
    }
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments