title: Count number of items in a Struct?
body: <p>I have a struct and am using it in many classes. I want to have a way of counting how many structs are initialised in each class (like an array.count) I cannot find anything on it.</p>
  
  <pre><code>struct measuredBMInfo {
    var level: Int
    var message: String
  
  init(level: Int, message: String) {
      self.level = level
      self.message = message
    }
  }
  </code></pre>
  
  <p>I use the struct as below:</p>
  
  <pre><code>// setup pain
  let painInfo0 = measuredPainInfo(level: 0, message: "No Pain")
  let painInfo1 = measuredPainInfo(level: 1, message: "Mild pain can be ignored")
  let painInfo2 = measuredPainInfo(level: 2, message: "Moderate pain that interferes with tasks")
  let painInfo3 = measuredPainInfo(level: 3, message: "Moderate pain interferes with concentration")
  let painInfo4 = measuredPainInfo(level: 4, message: "Severe pain interferes with basic tasks")
  let painInfo5 = measuredPainInfo(level: 5, message: "Worst possible pain bedrest required")
  </code></pre>
  
  <p>I want a count of measuredPainInfo in this case.</p>