Swift95

Text​Editor95

A multiline editor with a sunken surface and optional classic scroll indicator.

TextEditor95 wraps SwiftUI text editing in the same input treatment used by the rest of Swift95.

TextEditor95 multiline text control
The fitting and overflowing editors rendered by the snippet below.

Use it

import Swift95
import SwiftUI

struct TextEditor95Example: View {
  var body: some View {
    VStack(alignment: .leading, spacing: 12) {
      TextEditor95(text: .constant("Content fits without scrolling"))
        .frame(height: 90)

      TextEditor95(
        text: .constant(
          (1...20).map { "Overflow line \($0)" }.joined(separator: "\n")
        )
      )
      .frame(height: 130)
    }
  }
}

Essential behavior

ScrollingLong text scrolls vertically with the component’s classic indicator.
BindingEdits the supplied String binding directly.
SizingGive the editor an explicit or constrained height in flexible layouts.

Related

Open the complete TextEditor95 API reference →