[Solved] Dynamic key value type
You have to decode data depending on type. That means you have to first decode type and then continue depending on its value. Usually to store such items we would use an enum with associated values: enum Item: Decodable { case onboarding(OnboardingData) case entry(EntryData) init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) … Read more