How can we achieve proportional
size for Button
in SwiftUI
struct ContentView: View {
@State private var emailText = ""
@State private var passwordText = ""
var body: some View {
NavigationView {
ScrollView {
VStack(alignment: .center, spacing: 30.0, content: {
TextField("Enter Email", text: $emailText)
.textFieldStyle(RoundedBorderTextFieldStyle())
SecureField("Enter Password", text: $passwordText)
.textFieldStyle(RoundedBorderTextFieldStyle())
Button(action: {
print("Button Tapped")
}) {
Text("Login")
}.frame(width: 100,
height: 40,
alignment: .center).background(Color.orange)
Button(action: {
print("Button Tapped")
}) {
Text("Sign Up")
}.frame(width: 150,
height: 40,
alignment: .center).background(Color.yellow)
}).padding()
}
.navigationBarTitle("Login")
}
}
}
How to achieve proportional for Login and Sign Up button according to device wise.