Using Codable with object under single root key

While using codable we come across situations when our object keys are not at the root level //Final code /* JSON data { “dog”: { “id”: 1, “task”: “bow wow” } }*/ struct Dog: Codable { let id: Int let task: String } let decoder = JSONDecoder() let userDictionary = try decoder.decode([String: Dog].self, from: jsonData) let … Read more

Using PromiseKit and Alamofire For Clean API Layer

Promise kit and Alamofire when used together create a very powerful and flexible API Layer Every App interacting with web services contains an API layer which separates API handling from the rest of the application logic. Usually, the API layer is implemented using delegates or escaping closures. Escaping closures and delegates are neat but we can achieve … Read more