title: Swift - Struct or Dictionary
body: <p>In general, when storing dictionary style structured data such as:</p>
  
  <pre><code>let menuItems = [
      [
          "title": "View Profile",
          "icon": "iconSideProfile"
      ],
      [
          "title": "Invite Friends",
          "icon": "iconSideHeart"
      ],
      [
          "title": "Settings",
          "icon": "iconSideSettings"
      ],
      [
          "title": "Help",
          "icon": "iconSideHelp"
      ],
      [
          "title": "Logout",
          "icon": "iconSideLogout"
      ]
  ]
  </code></pre>
  
  <p>where we have an array of dictionaries that contain a title and an icon, is it better practice to store the dictionaries as dictionaries or structs?</p>
  
  <pre><code>struct MenuItem {
      let title: String
      let icon: String
  }
  
  let menuItems = [
      MenuItem(title: "View Profile", icon: "iconSideProfile"),
      ...
  ]
  </code></pre>
  
  <p>The advantages of storing in a struct being that the data is better defined, meaning you don't have to explicitly say that the dictionary will contain this key in some cases etc.</p>
  
  <p>Or is this too wasteful of resources?</p>