I have a loading screen where I want to show a text changing its value automatically with an animation.
I have my logo rotating indefinitely without any button action
//logo Image("reny") .rotationEffect(.degrees(rotateDegree)) .onAppear(perform: { withAnimation(Animation.linear(duration: 4).repeatForever(autoreverses: false)) { self.rotateDegree = 360 } }) I assumed it was possible to do the same for a text using a string array but it doesn't work
@State var texts = ["Find the Apartment you like", "send an application", "we'll approve you in secs baby!"] @State var textIndex : Int = 0 //introduction text Text(texts[textIndex]).bold() .font(.title) .onAppear(perform: { withAnimation(Animation.linear(duration: 2).repeatForever(autoreverses: false)) { textIndex += 1 } }) does anybody know how to change the value of a text with an animation automatically?
my intention is to show how to use the app during this loading time.
