Git Product home page Git Product logo

Comments (3)

InfRandomness avatar InfRandomness commented on August 22, 2024 1

Hey,

This would be a very cool feature to have
(sure, I'm the only one asking for it, very low demand)
We use ZippyJSON in our Swift Minecraft client and would love to see Linux support land

from zippyjson.

michaeleisel avatar michaeleisel commented on August 22, 2024

Closing due to low demand

from zippyjson.

ninjadev64 avatar ninjadev64 commented on August 22, 2024

In the meantime, anyone looking for a workaround may be able to use this wrapper.

import Foundation
#if !os(Linux)
import ZippyJSON
#endif

public struct CustomJSONDecoder {
  #if !os(Linux)
  public var keyDecodingStrategy: ZippyJSONDecoder.KeyDecodingStrategy = ZippyJSONDecoder.KeyDecodingStrategy.useDefaultKeys
  #else
  public var keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = JSONDecoder.KeyDecodingStrategy.useDefaultKeys
  #endif

  public init() {
    // Empty initialiser because we do not want the keyDecodingStrategy to be an initialiser parameter
  }

  public func decode<T: Decodable>(_ type: T.Type, from data: Data) throws -> T {
    #if !os(Linux)
    let decoder = ZippyJSONDecoder()
    #else
    let decoder = JSONDecoder()
    #endif
    decoder.keyDecodingStrategy = self.keyDecodingStrategy
    return try decoder.decode(type, from: data)
  }
}

from zippyjson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.