Overview:
- I have a TextEditor that uses a binding to a constant, so that value can't change.
Aim:
- I would like the text editor not to show the keyboard however still allow the user to copy text.
Question:
- How to achieve copying of text but without showing the keyboard?
- I would prefer to do in SwiftUI or is it only possible using
UIViewRepresentable?
Code:
import SwiftUI
struct TextView: View {
let text: String
var body: some View {
TextEditor(text: .constant(text))
}
}
struct TextView_Previews: PreviewProvider {
static var previews: some View {
let text = "this is some text"
TextView(text: text)
}
}