Untitled

 avatar
unknown
plain_text
3 years ago
3.6 kB
9
Indexable
//
//  SelfInspectionQuestionView.swift
//  Garageworks-iOS-Revamp
//
//  Created by mac on 26/12/22.
//

import SwiftUI

struct SelfInspectionQuestionView: View {
    
    private var selfInspectionServiceQuestions: [SelfInspectionServiceQuestions.Answers]? = []
    init(selfInspectionServiceQuestions: [SelfInspectionServiceQuestions.Answers]){
        self.selfInspectionServiceQuestions = selfInspectionServiceQuestions
    }
    
    private var selfInspectionServiceQuestionsResponse: SelfInspectionServiceQuestions? = nil
    init(selfInspectionServiceQuestionsResponse: SelfInspectionServiceQuestions){
        self.selfInspectionServiceQuestionsResponse = selfInspectionServiceQuestionsResponse
    }
    @StateObject private var selfInspectionObserver: SelfInspectionObserver = SelfInspectionObserver()

    var body: some View {
        GeometryReader{ geometry in
            VStack{
//                VStack(alignment:.leading){
                    HStack(alignment:.top,spacing: 10){
                        Image("GW_logo 1")
                            .resizable()
                            .frame(width:geometry.size.width * 0.13, height:50)
                            .onTapGesture {
                                print(selfInspectionObserver.storeQuestions,"@@@@@@")
                            }
                        //                        .padding()
                        Text(selfInspectionObserver.storeQuestions)
                            .padding(.all,10)
                            .frame(width:200,alignment: .leading)
                            .foregroundColor(.black)
                            .background(.white)
                            .cornerRadius(10)
                    }
                    .frame(width:geometry.size.width, height: geometry.size.height * 0.1, alignment: .leading)
//                .frame(width:geometry.size.width * 0.85, alignment: .leading)
//                .padding()
                
                HStack(alignment: .top){
                    VStack(spacing: 10){
                        ForEach(selfInspectionServiceQuestions ?? [], id: \.self){ item in
                            Text(item.answer ?? "")
                                .padding(.all,10)
                                .frame(width:200, alignment: .leading)
                                .foregroundColor(.black)
                                .background(.white)
                                .cornerRadius(10)
                                .onTapGesture {
//                                    SelfInspectionQuestionView(selfInspectionServiceQuestions: [SelfInspectionServiceQuestions.Answers])
                                }
                        }
                    }
                    .frame(width:geometry.size.width  * 0.6, height: geometry.size.height, alignment: .top)
                    VStack{
                        Image("person_icon")
                            .resizable()
                            .frame(width:geometry.size.width * 0.13, height:50,alignment: .top)
                    }
                    .frame(width:geometry.size.width * 0.135, height: geometry.size.height ,alignment: .top)
                    .padding(.trailing,30)
                }
                .frame(width:geometry.size.width, alignment: .trailing)
            }
            .padding()
        }
    }
}

struct SelfInspectionQuestionView_Previews: PreviewProvider {
    static var previews: some View {
//        SelfInspectionQuestionView(selfInspectionResponse: <#SelfInspectionObserver#>)
        EmptyView()
    }
}
Editor is loading...