41 lines
1000 B
Swift
41 lines
1000 B
Swift
import SwiftUI
|
|
|
|
struct DescriptionField: View {
|
|
|
|
@Binding
|
|
var text: String
|
|
|
|
var body: some View {
|
|
TextEditor(text: $text)
|
|
.font(.body)
|
|
.lineLimit(5, reservesSpace: true)
|
|
.frame(maxWidth: 400, minHeight: 50, maxHeight: 500)
|
|
.textEditorStyle(.plain)
|
|
.padding(.vertical, 8)
|
|
.padding(.leading, 3)
|
|
.background(Color.gray.opacity(0.1))
|
|
.cornerRadius(8)
|
|
}
|
|
}
|
|
|
|
struct OptionalDescriptionField: View {
|
|
|
|
@Binding
|
|
var text: String?
|
|
|
|
var body: some View {
|
|
TextEditor(text: Binding(
|
|
get: { text ?? "" },
|
|
set: { text = $0.isEmpty ? nil : $0 }
|
|
))
|
|
.font(.body)
|
|
.lineLimit(5, reservesSpace: true)
|
|
.frame(maxWidth: 400, minHeight: 50, maxHeight: 500)
|
|
.textEditorStyle(.plain)
|
|
.padding(.vertical, 8)
|
|
.padding(.leading, 3)
|
|
.background(Color.gray.opacity(0.1))
|
|
.cornerRadius(8)
|
|
}
|
|
}
|