ios – The best way to scroll mechanically when merchandise seems in SwiftUI? (up to date)


I’ve an inventory of names that seem vertically because of an animation, I want to have auto-scroll when a brand new title seems however i do not know the right way to go on…I noticed some questions like this however all of them had been a ‘soar to a quantity’ resolution, not progressively scroll…any solutions?

enter image description here

UPDATED CODE:

struct ContentView: View {
    let correctNames = ["Steve", "Bill", "John", "Elon", "Michael", "Justin", "Marcell", "David", "Gabriel", "Eric", "Jeffrey", "Taylor", "Jennifer", "Christian"]
    @State personal var animating = false
    
    var physique: some View {
        VStack {
            ScrollView(showsIndicators: false) {
                ForEach(0..<correctNames.depend, id: .self) { index in
                    Textual content("(correctNames[index])")
                        .font(.system(measurement: 60))
                        .opacity(animating ? 1 : 0)
                        .animation(.easeIn(period: 0.5).delay(Double(index) * 0.2), worth: animating)
                }
            }
        }
        .onAppear {
            animating.toggle()
        }
    }
}

Similar Posts

Leave a Reply

Your email address will not be published.