//
// ContentView.swift
// Chapter1
//
// Created by Kamal Nishad.
//
import SwiftUI
struct ContentView: View {
@State private var username: String = ""
@State private var password:String = ""
var body: some View {
VStack{
WelcomeText()
UserImage()
TextField("Enter Username",text: $username)
.padding()
.background(.regularMaterial)
.cornerRadius(5.0)
.padding(.bottom, 0)
SecureField("Enter Password",text: $password)
.padding()
.background(.regularMaterial)
.cornerRadius(5.0)
.padding(.bottom,5)
Text("Login")
.font(.headline)
.foregroundColor(.white)
.padding()
.frame(width: 150, height: 50)
.background(Color.green)
.cornerRadius(15.0)
}
}
}
struct WelcomeText:View{
var body: some View{
return Text("Welcome")
.font(.largeTitle)
.fontWeight(.semibold)
.padding(.bottom,20)
}
}
struct UserImage : View{
var body: some View{
return Image("profile")
.resizable()
.aspectRatio(UIImage(named:"profile")!.size,contentMode: .fill)
.frame(width: 120, height: 120)
.clipped()
.cornerRadius(180)
.padding(.bottom,20)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}