Home > AI > IOS > SwiftUI >

(View)GroupBox

Example 1:

struct ContentView: View {
    
    @State var text : String = ""
    @State var password : String = ""
    
    var body: some View {
        ZStack{
        
        Color(red: 240/255, green: 240/255, blue: 243/255)
    
        GroupBox(label: Label("Enter Your Details", systemImage: "sun.min")
                    .font(.subheadline), content: {
            VStack{
                TextField("Username", text: $text)
                    .textFieldStyle(RoundedBorderTextFieldStyle())
                    .padding(.all, 5)
                
                SecureField("Password", text: $password)
                    .textFieldStyle(RoundedBorderTextFieldStyle())
                    .padding(.all, 5)

                Button(action: {print("good")}) {
                    Image(systemName: "chevron.right")
                    .renderingMode(.template)
                    .foregroundColor(.black)
                    .frame(width: 30, height: 30)
                    .padding(10)
                    .background(Color(red: 240/255, green: 240/255, blue: 243/255))
                    .cornerRadius(10)
                }
                .shadow(color: Color.white, radius: 10, x: -10, y: -10)
                .shadow(color: Color(red: 174/255, green: 174/255, blue: 192/255).opacity(0.4), radius: 10, x: 10, y: 10)
            }
        })
        .cornerRadius(10)
        .shadow(color: Color.white, radius: 10, x: -10, y: -10)
        .shadow(color: Color(red: 174/255, green: 174/255, blue: 192/255).opacity(0.4), radius: 10, x: 10, y: 10)
        .padding()
        }
        .edgesIgnoringSafeArea(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/)
        .frame(maxWidth: .infinity,maxHeight: .infinity)
    }
}

Leave a Reply