Reputation: 1
I have a simple code of TextField, which has a frame and background, the Text starts from Center-leading which I want it start from Top-leading, how can I do this? thanks
import SwiftUI
struct ContentView: View {
@State private var stringOfText: String = "Hello, world!"
var body: some View {
TextField("", text: $stringOfText)
.frame(width: 300, height: 200, alignment: .center)
.background(Color.yellow)
}
}
Upvotes: 3
Views: 2570