title: How to Add an Extension to Swift Array To Conditionally Append?
body: <p>Is there a way to do this as an extension to Array as opposed to a switch statement that's going to grow and grow?</p>
  
  <pre><code>    fileprivate var exteriorColorOptions = [ExteriorColorOption]()
      fileprivate var otherOptions = [SomeOtherOption]()
        : more options
  
      func add(option:FilteredOption) {
  
          switch(option) {
          case let thing as ExteriorColorOption:
                  exteriorColorOptions.append(thing)
          case and on and on
          default:
              break
          }
      }
  </code></pre>
  
  <p>I would like to be able to just do the following with the right extension in place:</p>
  
  <pre><code>exteriorColorOptions.appendIfPossible(option)
  otherOptions.appendIfPossible(option)
  </code></pre>
  
  <p>Note: switch approach came from
  <a href="https://stackoverflow.com/questions/25724527/swift-test-class-type-in-switch-statement">Swift: Test class type in switch statement</a></p>