Skip to content

Instantly share code, notes, and snippets.

View Hungs20's full-sized avatar
👻

Chu Văn Hưng Hungs20

👻
View GitHub Profile
@Hungs20
Hungs20 / FlexibleValue_Codable.swift
Created February 5, 2024 07:13
Flexible codable
extension KeyedDecodingContainer {
enum FlexibleValue<T: Decodable>: Decodable {
case int(Int)
case string(String)
case double(Double)
case float(Float)
case bool(Bool)
case null
init(from decoder: Decoder) throws {

Keybase proof

I hereby claim:

  • I am hungs20 on github.
  • I am hungs20 (https://keybase.io/hungs20) on keybase.
  • I have a public key ASC41nPoED_c0LBBZF4Af8gWyrxhgZ8H5UQCO_2kWp9RWgo

To claim this, I am signing this object: