A TextView for SwiftUI
struct ContentView: View {
@State var text: String = "This is a testing text."
var body: some View {
TextView(text: $text)
}
}
TextView(text: $text, font: UIFont.systemFont(ofSize: 17))
ZStack(alignment: .topLeading) {
TextView(text: $text, font: UIFont.systemFont(ofSize: 17))
.frame(height: 100)
if text.isEmpty {
Text("Type something...")
.foregroundColor(.secondary)
.offset(x: 5, y: 5)
}
}
PlaceholderTextView("Description", text: self.$text)