title: Swift nested structures -- how to access element
body: <p>In a Swift app, I am attempting to nest structures for greater clarity. Here is the code:</p>
  
  <pre><code>struct ColorStruct {
      var colorname: String = ""
      struct RGB {
          var red:   Int = 0
          var green: Int = 0
          var blue:  Int = 0
      }
  }
  </code></pre>
  
  <p>I can access a <code>ColorStruct</code> element (example: "colorname") as long as it isn't nested. </p>
  
  <p>Q: What am I failing to understanding about how to properly access the "red" variable?</p>
  
  <pre><code>var newColor = ColorStruct()
  newColor.colorname = "Red"
  newColor.RGB.red   = 255     // Results in error:
  // Static member 'RGB' cannot be used on instance of type `ColorStruct`
  </code></pre>