title: Saving User Data to Array inside Struct
body: <p>I'd like to properly save inputted user data / variables inside an array which is inside a struct but unable to get it to work.</p>
  <p>Currently, I have a few structs:</p>
  <pre><code>struct Household: Codable {
      let id  = UUID()
      var region: String
      var householdSize: Int = 1
      var receivingBenefits: [String]
      var energyCrisis: Bool
      var utilityProviders: [String]
      var residenceType: String
      var propertyTaxPastDue, homeNeedsRepairs, filedPreviousYearTaxReturn, heatingSystemNeedsRepairs: Bool
      var atRiskOfHomelessness: Bool
      var receivedMaximumBenefit: ReceivedMaximumBenefit
      var personDetails: [PersonDetail]
      var incomes: [Income]
      var assets: [Asset]
  
      enum CodingKeys: String, CodingKey {
          case region
          case householdSize = &quot;household_size&quot;
          case receivingBenefits = &quot;receiving_benefits&quot;
          case energyCrisis = &quot;energy_crisis&quot;
          case utilityProviders = &quot;utility_providers&quot;
          case residenceType = &quot;residence_type&quot;
          case propertyTaxPastDue = &quot;property_tax_past_due&quot;
          case homeNeedsRepairs = &quot;home_needs_repairs&quot;
          case filedPreviousYearTaxReturn = &quot;filed_previous_year_tax_return&quot;
          case heatingSystemNeedsRepairs = &quot;heating_system_needs_repairs&quot;
          case atRiskOfHomelessness = &quot;at_risk_of_homelessness&quot;
          case receivedMaximumBenefit = &quot;received_maximum_benefit&quot;
          case personDetails = &quot;person_details&quot;
          case incomes, assets
      }
  }
  
  struct PersonDetail: Codable, Identifiable {
  
      let id  = UUID()  // &lt;-- here
      var age: Int = 18
      var maritalStatus: String = &quot;&quot;
      var minimumEmploymentOverExtendedPeriod: Bool
      var workStatus: String = &quot;&quot;
      var pregnant: Bool
      var attendingSchool: Bool = false
      var disabled: Bool
  
      enum CodingKeys: String, CodingKey {
          case age
          case maritalStatus = &quot;marital_status&quot;
          case minimumEmploymentOverExtendedPeriod = &quot;minimum_employment_over_extended_period&quot;
          case workStatus = &quot;work_status&quot;
          case pregnant
          case attendingSchool = &quot;attending_school&quot;
          case disabled
      }
  }
  
  class Base: ObservableObject, Codable {
      @Published var household: Household
  
      enum CodingKeys: String, CodingKey {
          case household = &quot;household&quot;
      }
  }
  </code></pre>
  <p>Now, I can easily bind a Textfield, toggle or Picker to anything under the Household struct for example below which I believe is easily connected via household in the Base() class..</p>
  <pre><code>HStack() {
     Image(systemName:&quot;wrench.and.screwdriver.fill&quot;)
                 .frame(width: 15, height: 15)
    Toggle(isOn: $eligBase.household.homeNeedsRepairs) {
             Text(&quot;Need Home Repairs?&quot;)
                     .font(.system(size: 15))
                }.tint(.blue)
            }
  </code></pre>
  <p>However, I'm unable to connect anything in the array`[PersonDetail], which I included the struct.</p>
  <p>For example, If I wanted to connected a Toggle for the disabled variable in `PersonDetail', I get an error, here is my disabled toggle:</p>
  <pre><code> Toggle(isOn: $eligBase.household.personDetails.disabled) {
                Text(&quot;Disabled&quot;)
                          .font(.system(size: 15))
  ......
  }
  </code></pre>
  <p>I receive an error stating:</p>
  <blockquote>
  <p>Value of type 'Binding&lt;[PersonDetail]&gt;' has no dynamic member
  'disabled' using key path from root type '[PersonDetail]'</p>
  </blockquote>
  <p>Any ideas how I can connect Toggles, Textfield, Picker to a variable in an array which is in a struct?</p>