title: Cannot assign value to stored property from within computed property
body: <p>I created a struct in which I have a property '_photo' that is lazily assigned when the computed property 'photo' is called.  I keep getting the error </p>
  
  <blockquote>
    <p>Cannot assign to '_photo' in 'self'</p>
  </blockquote>
  
  <p>Here is the code. I wrote the computed method in both Swift 1.1 (photo1) and swift 1.2 (photo2) syntax. Both give the same compile time error as noted above.</p>
  
  <p>What changes are needed to fix that error?</p>
  
  <pre><code>import UIKit
  
  public struct PhotoStruct {
      var _photo:UIImage?
      var urlString:String?
  
      init(image:UIImage?, url:String?){
          self._photo = image
          self.urlString = url
  
      }
  
      init(url:String?){
          self.urlString = url
      }
  
  
      var photo1:UIImage? {
  
          if let theURL = self._photo {
              return self._photo
          }else{
              if let urlString = self.urlString{
                  if let url = NSURL(string: urlString as String){
                      if let imageData :NSData = NSData(contentsOfURL: url){
                          if let image:UIImage = UIImage(data:imageData){
  
                              self._photo = image //** Cannot assign error is here**
                          }
                      }
                  }
              }
              return self._photo
          }
      }
  
      var photo2:UIImage? {
  
          if let theURL = self._photo {
              return self._photo
          }else{
              if let  urlString = self.urlString,
                      url = NSURL(string: urlString as String),
                      imageData :NSData = NSData(contentsOfURL: url),
                      image:UIImage = UIImage(data:imageData){
  
                              self._photo = image //** Cannot assign error is here**
              }
              return self._photo
          }
      }
  
  
  
  }
  </code></pre>