File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public typealias Codable = Encodable & Decodable
47
47
//===----------------------------------------------------------------------===//
48
48
49
49
/// A type that can be used as a key for encoding and decoding.
50
- public protocol CodingKey : CustomStringConvertible {
50
+ public protocol CodingKey : CustomStringConvertible , CustomDebugStringConvertible {
51
51
/// The string to use in a named collection (e.g. a string-keyed dictionary).
52
52
var stringValue : String { get }
53
53
@@ -68,8 +68,15 @@ public protocol CodingKey: CustomStringConvertible {
68
68
}
69
69
70
70
extension CodingKey {
71
+ /// A textual representation of this key.
71
72
public var description : String {
72
- return stringValue
73
+ let intValue = self . intValue? . description ?? " nil "
74
+ return " \( String ( describing: type ( of: self ) ) ) (stringValue: \( stringValue) , intValue: \( intValue) ) "
75
+ }
76
+
77
+ /// A textual representation of this key, suitable for debugging.
78
+ public var debugDescription : String {
79
+ return description
73
80
}
74
81
}
75
82
You can’t perform that action at this time.
0 commit comments