I want to pass a choicemade2 to select the reason for visit and choicemade to select clinician’s name

This is the RgistrationDetailView where I want to pass a selected value from RegistrationRowView

I changed “Clinician’s Name” to selection: RegistrationRowView(choiceMade: “”)

recieved the following.

error ?
Struct ‘ViewBuilder’ requires that ‘EmptyTableRowContent<V>’ conform to ‘View’

Struct ‘ViewBuilder’ requires that ‘TableHeaderRowContent<V, Text>’ conform to ‘View’

Static method ‘buildExpression’ requires that ‘LabeledContent<Text, Text>’ conform to ‘TableRowContent’

I was trying to return selected values of choicemade and choicemade2 from Registration Row View to Registration Detail View, in order to pass the selected choicemade and selected choice made2 options to RegistrationDetailView, so that I can save the Data in CoreData.

// 
// RegistrationDetailView.swift 
//  Registration 
// 
//  Created by Bibin Mathew on 7/2/24. 
//

import SwiftUI            


struct RegistrationDetailView: View 
{ 
var body: some View 
{ 
  List 
      { 
  Section("General") 
         {           
            LabeledContent 
            { 
                Text("First Name Here") 
            } 
        label: 
            { 
                Text("Enter First Name Here") 
            }
            LabeledContent
            {
                Text("Last Name Here")
            }
        label:
            {
                Text("Enter Last Name Here")
            }
        
            LabeledContent
            {
                Text(.now, style: .date)
            }
        label:
            {
                Text("Appointment Date")
            }
            LabeledContent
            {
                Text(selection: RegistrationRowView(choiceMade: ""))
            }
        label:
            {
                Text("Select Clinician's Name")
            }
            LabeledContent
            {
                Text("Reason for visit")
            }
        label:
            {
                Text("Select Reason For Vist")
            }
        }
    }
}
}

#Preview 
{ 
RegistrationDetailView() 
}



// 
//  RegistrationRowView.swift 
//  Registration 
// 
//  Created by Bibin Mathew on 7/2/24. //
import SwiftUI

struct RegistrationRowView: View {


let dateFormatter: DateFormatter =
{
    let formatter = DateFormatter()
    formatter.dateStyle = .long
    return formatter
}()
@State private var AppointmentDate = Date.now
@State private var FirstName: String = ""
@State private var LastName: String = ""
@State var choiceMade = "Select Clinician's Name"
@State var choiceMade2 = "Select Reason for visit"
var body: some View
{
    NavigationStack
    {
        List
        {
            VStack
            {
                DatePicker(selection: $AppointmentDate, in: ...Date.now, displayedComponents: .date)
                {
                    Text("Appointment Date")
                }
                
                Text("Appointment Date is (AppointmentDate, formatter: dateFormatter)").font(.custom("Chalkduster", size: 15))
            }
            VStack {
                TextField(
                    "First Name",
                    text: $FirstName
                ).textFieldStyle(.roundedBorder)
                    .font(.custom("Chalkduster", size: 15))
                    .disableAutocorrection(true)
                TextField(
                    "Last Name",
                    text: $LastName
                ).textFieldStyle(.roundedBorder)
                    .font(.custom("Chalkduster", size: 15))
                    .disableAutocorrection(true)
            }
            .textFieldStyle(.roundedBorder)
            
            VStack
            {
                TextField("Select Clinician's Name", text:$choiceMade)
                    .textFieldStyle(.roundedBorder)
                    .font(.custom("Chalkduster", size: 15))
                Menu
                {
                    Button(action: {choiceMade = "LC Amanda Anderson"},label: {Text("LC   Amanda Anderson")})
                    Button(action: {choiceMade = "Dr. Anthony Franklin"},label: {Text("Dr. Anthony Franklin")})
                    Button(action: {choiceMade = "LC Elsie Burgos-Carillo"},label: {Text("LC Elsie Burgos-Carrillo")})
                    Button(action: {choiceMade = "Ingrid Urbaez"},label: {Text("Ingrid Urbaez")})
                    Button(action: {choiceMade = "LC Kelly Allen"},label: {Text("LC Kelly Allen")})
                    Button(action: {choiceMade = "LC Kimberly Galloway"},label: {Text("LC Kimberly Galloway")})
                    Button(action: {choiceMade = "Dr. Michael Grove"},label: {Text("Dr. Michael Grove")})
                    Button(action: {choiceMade = "LC Selam Kebede"},label: {Text("LC Selam Kebede")})
                    Button(action: {choiceMade = "LC Susan Savelli"},label: {Text("LC Susan Savelli")})
                    Button(action: {choiceMade = "Do not know"},label: {Text("Do not know")})
                }
            label:
                {
                    Label(title: {Text("(choiceMade)").position(x:75,y:0)}, icon: {Image(systemName:"plus")})
                    
                }
                if (choiceMade == "LC Amanda Anderson")
                {
                    Text("You have an appointment with LC Amanda Anderson").font(.custom("Chalkduster", size: 15))
                }
                if (choiceMade == "Dr. Anthony Franklin")
                {
                    Text("You have an appointment with Dr. Anthony Franklin").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade == "LC Elsie Burgos-Carrillo")
                {
                    Text("You have an appointment with LC Elsie Burgos Carrillo").font(.custom("Chalkduster", size: 30))
                }
                if (choiceMade == "Ingrid Urbaez")
                {
                    Text("You have an appointment with Ingrid Urbaez").font(.custom("Chalkduster", size: 15))
                }
                if (choiceMade == "LC Kelly Allen")
                {
                    Text("You have an appointment with LC Kelly Allen").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade == "LC Kimberly Galloway")
                {
                    Text("You have an appointment with LC Kimberly Galloway").font(.custom("Chalkduster", size: 15))
                }
                if (choiceMade == "Dr. Michael Grove")
                {
                    Text("You have an appointment with Dr. Michael Grove").font(.custom("Chalkduster", size: 15))
                }
                if (choiceMade == "LC Selam Kebede")
                {
                    Text("You have an appointment with LC Selam Kebede").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade == "LC Susan Savelli")
                {
                    Text("You have an appointment with LC Susan Savelli").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade == "Do not know")
                {
                    Text("Please take a seat while we get the information for you.").font(.custom("Chalkduster", size: 15))
                }
            }
            
            VStack
            {
                TextField("Select Reason for Visit", text:$choiceMade2)
                    .textFieldStyle(.roundedBorder)
                    .font(.custom("Chalkduster", size: 15))
                Menu
                {
                    Button(action: {choiceMade2 = "Counselling"},label: {Text("Counselling")})
                    Button(action: {choiceMade2 = "Court Ordered Evaluation"},label: {Text("Court Ordered Evaluation")})
                    Button(action: {choiceMade2 = "Case Management"},label: {Text("Case Management")})
                    Button(action: {choiceMade2 = "Informational Resources"},label: {Text("Informational Resources")})
                    Button(action: {choiceMade2 = "Crisis"},label: {Text("Crisis")})
                    Button(action: {choiceMade2 = "Do not know"},label: {Text("Do not know")})
                }
            label:
                {
                    Label(title: {Text("(choiceMade2)").position(x:75,y:0)}, icon: {Image(systemName:"plus")})
                    
                }
                if (choiceMade2 == "Counselling")
                {
                    Text("You are here for Counselling").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade2 == "Court Ordered Evaluation")
                {
                    Text("You are here for Court Ordered Evaluation").font(.custom("Chalkduster", size: 15))
                }
                if (choiceMade2 == "Case Management")
                {
                    Text("You are here for Case Management").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade2 == "Informational Resources")
                {
                    Text("You are here for Informational Resources").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade2 == "Crisis")
                {
                    Text("How can we assist you today?").font(.custom("Chalkduster", size: 15))
                }
                if(choiceMade2 == "Do not know")
                {
                    Text("Please take a seat while we check how we can help you today.").font(.custom("Chalkduster", size: 15))
                }
            }
            .frame(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, alignment: .leading)
            .overlay(alignment: .topTrailing)
            {
                Button
                {
                    // To Do: Handle Adult Logic
                }
            label:
                {
                    Image(systemName: "star")
                        .font(.largeTitle)
                        .symbolVariant(/*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
                        .foregroundColor(.gray.opacity(0.3))
                }
                .buttonStyle(.plain)
            }
            HStack {
                Spacer()

                Button("Save") {
                    //button action code
                }
                .buttonStyle(.borderless) // <-- add this line
                //or pre-iOS15: .buttonStyle(BorderlessButtonStyle())

                Spacer()

                Button("Add") {
                    //button action code
                }
                .buttonStyle(.borderless) // <-- add this line
                //or pre-iOS15: .buttonStyle(BorderlessButtonStyle())

                Spacer()
            }
        }
        .navigationTitle("Registrations")
    }
}
} #Preview 
{
 NavigationStack 
{ RegistrationRowView()

}

}

New contributor

Bibin Mathew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật