title: Can an enum contain another enum values in Swift?
body: <p>I'd like to share some enum properties. Something like:</p>
  
  <pre><code>enum State {
    case started
    case succeeded
    case failed
  }
  
  enum ActionState {
    include State // what could that be?
    case cancelled
  }
  
  class Action {
    var state: ActionState = .started
  
    func set(state: State) {
      self.state = state
    }
  
    func cancel() {
      self.state = .cancelled
    }
  }
  </code></pre>
  
  <p>I see why <code>ActionState</code> can not inherit from <code>State</code> (because the state <code>cancelled</code> has no representation in <code>State</code>) but I want to still be able to say "ActionState is like State with more options, and ActionState can get inputs that are of type State, because they are also of type ActionState"</p>
  
  <p>I see how I could get the above logic to work with copying the cases in <code>ActionState</code> and having a switch in the <code>set</code> function. But I'm looking for a better way.</p>
  
  <p>I know enum can't inherit in Swift, and I've read the protocol answer of <a href="https://stackoverflow.com/a/36330407/2054629">swift-enum-inheritance</a>. It doesn't address the need for "inheriting" or including cases from another enum, but only properties and variables.</p>