修改pods
This commit is contained in:
@@ -122,7 +122,6 @@ public class FirebaseDataEncoder {
|
||||
case millisecondsSince1970
|
||||
|
||||
/// Encode the `Date` as an ISO-8601-formatted string (in RFC 3339 format).
|
||||
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
|
||||
case iso8601
|
||||
|
||||
/// Encode the `Date` as a string formatted by the given formatter.
|
||||
@@ -287,7 +286,7 @@ public class FirebaseDataEncoder {
|
||||
/// - returns: A new `Data` value containing the encoded JSON data.
|
||||
/// - throws: `EncodingError.invalidValue` if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is `.throw`.
|
||||
/// - throws: An error if any value throws an error during encoding.
|
||||
open func encode<T : Encodable>(_ value: T) throws -> Any {
|
||||
open func encode<T : Encodable>(_ value: T) throws -> sending Any {
|
||||
let encoder = __JSONEncoder(options: self.options)
|
||||
|
||||
guard let topLevel = try encoder.box_(value) else {
|
||||
@@ -823,11 +822,7 @@ extension __JSONEncoder {
|
||||
return NSNumber(value: 1000.0 * date.timeIntervalSince1970)
|
||||
|
||||
case .iso8601:
|
||||
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
|
||||
return NSString(string: _iso8601Formatter.string(from: date))
|
||||
} else {
|
||||
fatalError("ISO8601DateFormatter is unavailable on this platform.")
|
||||
}
|
||||
|
||||
case .formatted(let formatter):
|
||||
return NSString(string: formatter.string(from: date))
|
||||
@@ -1080,7 +1075,6 @@ public class FirebaseDataDecoder {
|
||||
case millisecondsSince1970
|
||||
|
||||
/// Decode the `Date` as an ISO-8601-formatted string (in RFC 3339 format).
|
||||
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
|
||||
case iso8601
|
||||
|
||||
/// Decode the `Date` as a string parsed by the given formatter.
|
||||
@@ -1231,7 +1225,7 @@ public class FirebaseDataDecoder {
|
||||
/// Decodes a top-level value of the given type from the given JSON representation.
|
||||
///
|
||||
/// - parameter type: The type of the value to decode.
|
||||
/// - parameter data: The data to decode from.
|
||||
/// - parameter structure: The data to decode from.
|
||||
/// - returns: A value of the requested type.
|
||||
/// - throws: `DecodingError.dataCorrupted` if values requested from the payload are corrupted, or if the given data is not valid JSON.
|
||||
/// - throws: An error if any value throws an error during decoding.
|
||||
@@ -2443,16 +2437,12 @@ extension __JSONDecoder {
|
||||
return Date(timeIntervalSince1970: double / 1000.0)
|
||||
|
||||
case .iso8601:
|
||||
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
|
||||
let string = try self.unbox(value, as: String.self)!
|
||||
guard let date = _iso8601Formatter.date(from: string) else {
|
||||
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: self.codingPath, debugDescription: "Expected date string to be ISO8601-formatted."))
|
||||
}
|
||||
|
||||
return date
|
||||
} else {
|
||||
fatalError("ISO8601DateFormatter is unavailable on this platform.")
|
||||
}
|
||||
|
||||
case .formatted(let formatter):
|
||||
let string = try self.unbox(value, as: String.self)!
|
||||
@@ -2621,8 +2611,7 @@ fileprivate struct _JSONKey : CodingKey {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// NOTE: This value is implicitly lazy and _must_ be lazy. We're compiled against the latest SDK (w/ ISO8601DateFormatter), but linked against whichever Foundation the user has. ISO8601DateFormatter might not exist, so we better not hit this code path on an older OS.
|
||||
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
|
||||
fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
|
||||
nonisolated(unsafe) fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
|
||||
let formatter = ISO8601DateFormatter()
|
||||
formatter.formatOptions = .withInternetDateTime
|
||||
return formatter
|
||||
|
||||
Reference in New Issue
Block a user