You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stdlib/public/SDK/Foundation/PlistEncoder.swift
+43-20Lines changed: 43 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,35 @@ open class PropertyListEncoder {
50
50
/// - throws: `EncodingError.invalidValue` if a non-comforming floating-point value is encountered during encoding, and the encoding strategy is `.throw`.
51
51
/// - throws: An error if any value throws an error during encoding.
throwEncodingError.invalidValue(value,EncodingError.Context(codingPath:[], debugDescription:"Unable to encode the given top-level value as a property list", underlyingError: error))
72
+
}
73
+
}
74
+
75
+
/// Encodes the given top-level value and returns its plist-type representation.
76
+
///
77
+
/// - parameter value: The value to encode.
78
+
/// - returns: A new top-level array or dictionary representing the value.
79
+
/// - throws: `EncodingError.invalidValue` if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is `.throw`.
80
+
/// - throws: An error if any value throws an error during encoding.
throwEncodingError.invalidValue(value,EncodingError.Context(codingPath:[], debugDescription:"Unable to encode the given top-level value as a property list", underlyingError: error))
81
-
}
92
+
return topLevel
82
93
}
83
94
}
84
95
@@ -620,7 +631,19 @@ open class PropertyListDecoder {
620
631
}catch{
621
632
throwDecodingError.dataCorrupted(DecodingError.Context(codingPath:[], debugDescription:"The given data was not a valid property list.", underlyingError: error))
0 commit comments