Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into release/1.66
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jul 26, 2024
2 parents 52bab25 + 3c5a34b commit 575c3c8
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ struct HackerTextView: View {

setRandomCharacters()
animateText()
applyFinalTextCharacters()
}
.onChange(of: text) { _ in
animatedText = text
animationID = UUID().uuidString

setRandomCharacters()
animateText()
applyFinalTextCharacters()
}
}

Expand Down Expand Up @@ -95,6 +97,20 @@ struct HackerTextView: View {
animatedText.replaceSubrange(index...index, with: String(character))
}
}

private func applyFinalTextCharacters() {
let currentID = animationID

DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
guard currentID == animationID else {
return
}

if animatedText != text {
animatedText = text
}
}
}
}

#if DEBUG
Expand Down

0 comments on commit 575c3c8

Please sign in to comment.