* chore: add swift helper * chore: separate out types into types pkg * chore: only build apps/www for now * chore: don't build swift helper as part of pnpm i
20 lines
No EOL
624 B
Swift
20 lines
No EOL
624 B
Swift
import Foundation
|
|
|
|
// Shared JSON helper functions to avoid redeclaration errors across generated files
|
|
enum JSONHelpers {
|
|
static func newJSONDecoder() -> JSONDecoder {
|
|
let decoder = JSONDecoder()
|
|
if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
|
|
decoder.dateDecodingStrategy = .iso8601
|
|
}
|
|
return decoder
|
|
}
|
|
|
|
static func newJSONEncoder() -> JSONEncoder {
|
|
let encoder = JSONEncoder()
|
|
if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
|
|
encoder.dateEncodingStrategy = .iso8601
|
|
}
|
|
return encoder
|
|
}
|
|
} |