SwiftUI: Get notified when @Binding value changes
Use the onChange modifier instead of onAppear() to watch the textString binding. struct TypewriterTextView: View { @Binding var textString:String @State private var typingInterval = 0.3 @State private var typedString = “” var body: some View { Text(typedString).onChange(of: textString) { typedString = “” Timer.scheduledTimer(withTimeInterval: self.typingInterval, repeats: true, block: { timer in if self.typedString.length < self.textString.length { … Read more