Top "Decodable" questions

Use this tag only for questions directly pertaining to the Swift Decodable protocol introduced in Swift 4.

Codable class does not conform to protocol Decodable

Why am I getting a "Type 'Bookmark' does not conform to protocol 'Decodable'" error message? class Bookmark: Codable { weak var …

swift swift4 codable decodable
Protocol type cannot conform to protocol because only concrete types can conform to protocols

Within the app, we have two types of Stickers, String and Bitmap. Each sticker pack could contain both types. This …

ios swift protocols codable decodable
How to use Any in Codable Type

I'm currently working with Codable types in my project and facing an issue. struct Person: Codable { var id: Any } id …

ios swift codable decodable encodable
Swift Codable null handling

I have a struct that parse JSON using Codable. struct Student: Codable { let name: String? let amount: Double? let adress: …

ios json swift codable decodable
Swift 4 Decodable: The given data was not valid JSON

I'm trying to write a POST request to my local server, this is my function: @IBAction func postButtonAction(_ sender: UIButton) { …

ios json swift codable decodable
Swift 4 Decodable - No value associated with key CodingKeys

I'm decoding a JSON response in my Swift App, and the code used to work till it decided to stop …

json swift decodable
Swift Codable init

I would like to do some initialization logic after the Swift Coding/Encoding feature has finished decoding a JSON. struct …

json swift codable decodable
Swift 4 Decodable with keys not known until decoding time

How does the Swift 4 Decodable protocol cope with a dictionary containing a key whose name is not known until runtime? …

json swift4 decodable
Swift Codable decode empty json as nil or empty object

Here's my code: class LoginUserResponse : Codable { var result: String = "" var data: LoginUserResponseData? var mess: [String] = [] } public class LoginUserResponseData : Codable { var …

ios swift codable decodable
iOS Swift Decodable: Error: Cannot invoke initializer for type with no arguments

I'm getting error in initialising a struct, please see the screenshot attached below. After debugging I found that including review …

ios swift swift4 decodable