Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created June 23, 2020 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/19b36538ae4c4852bb41aaec08508e12 to your computer and use it in GitHub Desktop.
Save stevencurtis/19b36538ae4c4852bb41aaec08508e12 to your computer and use it in GitHub Desktop.
multilineview
import SwiftUI
struct MultilineView: View {
@State private var yourText: String = "Enter your text here!"
var body: some View {
Background {
TextEditor(text: $yourText)
.frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, alignment: .top)
}.onTapGesture {
self.endEditing()
}
}
private func endEditing() {
UIApplication.shared.endEditing()
}
}
struct MultilineView_Previews: PreviewProvider {
static var previews: some View {
MultilineView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment