编辑代码

ContentView.swift
LoginSiftUI
Created by Zhifeng Chen on 2020/8/1.
Copyright c 2020 Zhifeng Chen.All rights reserved.
import swiftUI
struct ContentView : View{
    @state var userName : String=""
    @state var passWord : String=""
    var body: some View{
        VStack{
            Text("欢迎使用找不同")
            .font(.title)//字体大小为标题
            .padding()//四周间隔
            Divider()
            .background(Color(.brown))//背景色为brown
            Image(systemName:"person")//系统图像person
            .resizable()//允许改变图像尺寸
            .frame(width : 150,height: 150)//尺寸改为150*150
            .cornerRadius(50)//圆角半径50
            VStack{
                TextField("请输入用户名",Text:$userName)
                .padding(.leading,10)//前方间隔10
                .background(Color(.lightGray))//背景色
                .cornerRadius(15)//圆角半径15
            }
            .padding()//四周默认间隔
            Button(action:{
                print("被点击了...")
            },label: {Text("登录")})
            .padding()
            Spacer()
        }
    }
}
struct ContentView_previews: previewProvider{
    static var previews: some View{
        ContentView()
    }
}