title: How to migrate Alamofire router class to Swift 3?
body: <p>Does anybody know how to change this entire approach to Swift 3? At this moment I have something very similar to this working OK on Swift 2.2 but now I'm trying to change that to Swift 3.</p>
  
  <p>I am getting some errors with the "URLRequestConvertible", with the Alamofire.Method (that I changed to HTTPMethod and now is working) and also with the parameter encoding, besides that I'm not conforming the entire protocol.</p>
  
  <p>I'm waiting for guidance from engineers at Alamofire, but I am looking to see what I can accomplish in the meantime.</p>
  
  <pre><code>enum Router: URLRequestConvertible {
  static let baseURLString = "http://example.com"
  static var OAuthToken: String?
  
  case CreateUser([String: AnyObject])
  case ReadUser(String)
  case UpdateUser(String, [String: AnyObject])
  case DestroyUser(String)
  
  var method: Alamofire.Method {
      switch self {
      case .CreateUser:
          return .POST
      case .ReadUser:
          return .GET
      case .UpdateUser:
          return .PUT
      case .DestroyUser:
          return .DELETE
      }
  }
  
  var path: String {
      switch self {
      case .CreateUser:
          return "/users"
      case .ReadUser(let username):
          return "/users/\(username)"
      case .UpdateUser(let username, _):
          return "/users/\(username)"
      case .DestroyUser(let username):
          return "/users/\(username)"
      }
  }
  
  // MARK: URLRequestConvertible
  
  var URLRequest: NSMutableURLRequest {
      let URL = NSURL(string: Router.baseURLString)!
      let mutableURLRequest = NSMutableURLRequest(URL: URL.URLByAppendingPathComponent(path))
      mutableURLRequest.HTTPMethod = method.rawValue
  
      if let token = Router.OAuthToken {
          mutableURLRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
      }
  
      switch self {
      case .CreateUser(let parameters):
          return Alamofire.ParameterEncoding.JSON.encode(mutableURLRequest, parameters: parameters).0
      case .UpdateUser(_, let parameters):
          return Alamofire.ParameterEncoding.URL.encode(mutableURLRequest, parameters: parameters).0
      default:
          return mutableURLRequest
      }
  }
  }
  </code></pre>