Swift
1 2import SwiftUI 3 4struct InsertLoginView: View { 5 6 @State private var email = "" 7 @State private var password = "" 8 9 var body: some View { 10 VStack(alignment: .center, spacing: 16 ){ 11 TextField("Email", text: self.$email) 12 .padding() 13 .background(Color("LightGrayColor")) 14 .cornerRadius(20.0) 15 TextField("Password", text: self.$password) 16 .padding() 17 .background(Color("LightGrayColor")) 18 .cornerRadius(20.0) 19 Button("Sign In") {} 20 .font(.headline) 21 .foregroundColor(.white) 22 .padding() 23 .frame(width: 300, height: 50) 24 .background(Color("SecondaryColor")) 25 .cornerRadius(15.0) 26 27 28 } 29 30 } 31} 32 33struct InsertLoginView_Previews: PreviewProvider { 34 static var previews: some View { 35 InsertLoginView() 36 } 37} 38
Swift
1import SwiftUI 2 3struct LoginView: View { 4 var body: some View { 5 VStack { 6 Text("Welcom to Food App") 7 .font(.largeTitle) 8 .fontWeight(.bold) 9 .padding() 10 } 11 } 12} 13 14struct LoginView_Previews: PreviewProvider { 15 static var previews: some View { 16 LoginView() 17 } 18}
<全体のコード>
Swift
1import SwiftUI 2 3struct LoginViewControll: View { 4 var body: some View { 5 VStack (alignment: .center, spacing: 16){ 6 LoginView() 7 .padding() 8 Spacer() 9 Image(uiImage: #imageLiteral(resourceName: "cloud-4273197_1280")) 10 .resizable() 11 .frame(width: 300.0, height: 300.0, alignment: .leading) 12 .cornerRadius(18.0) 13 .padding() 14 .shadow(radius: 10) 15 Spacer() 16 InsertLoginView() 17 } 18 .padding() 19 } 20 21} 22 23 24struct LoginViewControll_Previews: PreviewProvider { 25 static var previews: some View { 26 LoginViewControll() 27 } 28} 29
あなたの回答
tips
プレビュー