// Ruled lines for typing on: a pencil hairline every `pitch` points, drawn// behind a multi-line field so the words sit on the paper's own lines. The// field sets its line spacing so one typed line is one pitch.importSwiftUIstructRuledLines: View { @Environment(\.theme) privatevar theme/// The distance between two rules — one typed line at 15pt with its/// spacing (`paper_ruled_line_pitch`).privatevar pitch: CGFloat { RuledLinesKnobs.paperRuledLinePitch }// The line spacing a 15pt typewriter field needs to land on the rules is// the worn theme's `paper_ruled_typed_spacing`, which the field reads.var body: someView {Canvas { context, size invar y = pitchwhile y <= size.height {var line = Path() line.move(to: CGPoint(x: 0, y: y)) line.addLine(to: CGPoint(x: size.width, y: y)) context.stroke( line, with: .color(theme.print(.pencil).opacity(Double(RuledLinesKnobs.paperRuledLineOpacity))), lineWidth: theme.scale.hairline ) y += pitch } } .accessibilityHidden(true) }}/// The sizes, counts and timings RuledLines draws with: Swift's own, beside/// their reader — a theme sets only its tokens (`scale.tokens`).enumRuledLinesKnobs {staticlet paperRuledLineOpacity: CGFloat = 0.3staticlet paperRuledLinePitch: CGFloat = 26}