Created
June 23, 2020 16:44
-
-
Save stevencurtis/19b36538ae4c4852bb41aaec08508e12 to your computer and use it in GitHub Desktop.
multilineview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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