title: Performing array functions on an array of structs
body: <p>Let's say that I have the following Struct:</p>
  
  <pre><code>struct LogInfo {
      var logNumber: Int
      var species: String
      var diameter: Float
      var formClass: Int
      var numLogs: Float
      var boardFootage: Double
  }
  </code></pre>
  
  <p>And it is populated by the following:</p>
  
  <pre><code>var logInfoArray = [LogInfo]()
  
  logInfoArray.append(LogInfo(logNumber: 1, species: "Spruce", diameter: 18.0, formClass: 78, numLogs: 1.5, boardFootage: 110.0))
  logInfoArray.append(LogInfo(logNumber: 2, species: "Spruce", diameter: 17.0, formClass: 78, numLogs: 1.0, boardFootage: 90.0))
  logInfoArray.append(LogInfo(logNumber: 3, species: "Pine", diameter: 18.0, formClass: 78, numLogs: 1.5, boardFootage: 89.0))
  logInfoArray.append(LogInfo(logNumber: 4, species: "Pine", diameter: 21.0, formClass: 78, numLogs: 1.0, boardFootage: 120.0))
  logInfoArray.append(LogInfo(logNumber: 5, species: "Pine", diameter: 19.0, formClass: 78, numLogs: 1.5, boardFootage: 200.0))
  logInfoArray.append(LogInfo(logNumber: 6, species: "Oak", diameter: 22.0, formClass: 78, numLogs: 2, boardFootage: 180.0))
  </code></pre>
  
  <p>How would I go about performing some array functions on these entries?</p>
  
  <p>For example - I would like figure out how many unique species are in the array, and end up with a new array containing each individual species.</p>
  
  <pre><code>i.e. var speciesArray = ["Spruce", "Pine", "Oak"]
  </code></pre>
  
  <p>I would also like to be able to then perform some calculations with those in mind. Like, tallying up the total board footage values of all entries that have "Pine" as the species.</p>
  
  <p>Does anybody have some tips on how I could go about this?</p>
  
  <p>Thank you in advance!</p>