title: Swift - Enum takes an integer and determine range
body: <p>I want to have an enum that can take an Integer value and use it to determine which case associated with it and return image. Below is something that I want to achieve but I'm not quite know how to implement it. Thank you so much for you help!</p>
  
  <pre><code>enum Icon (input: Int) {
  //use input value to check which case need to return image name
     case 0...100
     case 101...200
     case 201+
  
  var image: UIImage {
      switch self {
          case .0...100: return UIImage(named: "plane.png")!
          case .101...200: return UIImage(named: "arrow.png")!
          case .201+: return UIImage(named: "logo.png")!
      }
    }
  }
  </code></pre>