-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux compatibility #6
Comments
Closing due to low demand |
Hey, This would be a very cool feature to have |
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)
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, it only works with iOS and MacOS. Some things will need to be reworked for Linux (it basically can't use Objective-C)
The text was updated successfully, but these errors were encountered: