title: Not able to parse generic Codable
body: <p>I am working with generic codable to pass network response. I have created below function which decode data and return in result:</p>
  
  <p>Here is piece of that function:</p>
  
  <pre><code> guard let jsonDataUnwrapped = jsonData,
                    let result: ServerResponse&lt;T&gt; = try? JSONDecoder().decode(ServerResponse&lt;T&gt;.self, from: jsonDataUnwrapped) else {
                  completionHandler(.error(APIError.init(type: .parsingError)))
                  return
              }
  </code></pre>
  
  <p>Code in ServerResponse:</p>
  
  <pre><code>struct ServerResponse&lt;T: Codable&gt; : Codable {
      var response: T
      var errors: [ServerError]
  }
  
  struct ServerError : Codable {
      var code: Int
      var message: String
  }
  </code></pre>
  
  <p>In codable class i am doing this:</p>
  
  <pre><code>init(from decoder: Decoder) throws {
          let values = try decoder.container(keyedBy: CodingKeys.self)
          email = try values.decodeIfPresent(String.self, forKey: .email)
          firstName = try values.decodeIfPresent(String.self, forKey: .firstName)
          lastName = try values.decodeIfPresent(String.self, forKey: .lastName)
          phoneNumber = try values.decode(String.self, forKey: .phoneNumber)
          if let status = try values.decodeIfPresent(String.self, forKey: .accountStatus) {
              accountStatus = UserStatus(rawValue: status)!
          }
      }
  </code></pre>
  
  <p>This code work proper when i get data in response key. But there is a case where i will also get empty response key and have some errors:</p>
  
  <pre><code>{
      "response": {},
      "errors": [
          {
              "code": "104",
              "message": "Authentication failed"
          }
      ]
  }
  </code></pre>
  
  <p>When i get empty response i need errors array but i am not able to get that.</p>