Typewriter Text

Typewriter Text

A text reveal component that types characters one by one with a blinking cursor and tap-to-replay behavior.

Luiz Mello
  • text
  • animation
  • ui

snippet.swift83 lines

//// Reveals text character by character with a blinking cursor.// Tap to replay the animation.​struct TypewriterText: View {    let fullText: String    var speed: Double = 0.06    var font: Font = .title2.weight(.medium)​    @State private var displayed = ""    @State private var cursorVisible = true    @State private var finished = false​    var body: some View {        HStack(alignment: .bottom, spacing: 1) {            Text(displayed)                .font(font)​            Rectangle()                .fill(.primary)​// ... (click "Show full code" to see more)