title: How do I report error when setting a swift property?
body: <p>Given that Swift does not have exception handling how do I communicate errors back to the caller when they pass an incorrect value for a property. Essentially, can properties have validation?</p>
  
  <p>Here is an example. Consider <strong>numberOfShoes</strong> property below. It's computed </p>
  
  <pre><code>class Animal {
      var name : String
      var numberOfLegs : Int
  
      var numberOfShoes : Int {
          get {return numberOfLegs }
          set {
              if newValue &lt; 0 {
                  // TODO: WHAT GOES HERE?
              }
  
              numberOfLegs = newValue
          }
      }
  
      init(name : String, numberOfLegs : Int) {
          self.name = name
          self.numberOfLegs = numberOfLegs
      }
  }
  </code></pre>
  
  <p>We could (should maybe) also have a willSet / didSet observer on numberOfLegs but I don't see how validation can be done here either.</p>
  
  <p>Are we required to stick with things like:</p>
  
  <pre><code>var cat = Animal("Cat", 4)
  if !cat.setNumberOfLegs(3) {
     // I guess that didn't work...
  }
  </code></pre>
  
  <p>What is everyone else doing?</p>