@@ -5535,33 +5535,34 @@ internal struct _DictionaryCodingKey: CodingKey {
5535
5535
/// and decoding `Dictionary` values keyed by the conforming type to and from
5536
5536
/// a keyed container, rather than encoding and decoding the dictionary as an
5537
5537
/// unkeyed container of alternating key-value pairs.
5538
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5538
+ @available ( SwiftStdlib 5 . 6 , * )
5539
5539
public protocol CodingKeyRepresentable {
5540
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5540
+ @available ( SwiftStdlib 5 . 6 , * )
5541
5541
var codingKey : CodingKey { get }
5542
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5542
+ @available ( SwiftStdlib 5 . 6 , * )
5543
5543
init ? < T: CodingKey > ( codingKey: T )
5544
5544
}
5545
5545
5546
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5547
- extension RawRepresentable where Self: CodingKeyRepresentable , RawValue == String {
5548
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5546
+ @available ( SwiftStdlib 5 . 6 , * )
5547
+ extension RawRepresentable
5548
+ where Self: CodingKeyRepresentable , RawValue == String {
5549
+ @available ( SwiftStdlib 5 . 6 , * )
5549
5550
public var codingKey : CodingKey {
5550
5551
_DictionaryCodingKey ( stringValue: rawValue)
5551
5552
}
5552
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5553
+ @available ( SwiftStdlib 5 . 6 , * )
5553
5554
public init ? < T: CodingKey > ( codingKey: T ) {
5554
5555
self . init ( rawValue: codingKey. stringValue)
5555
5556
}
5556
5557
}
5557
5558
5558
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5559
+ @available ( SwiftStdlib 5 . 6 , * )
5559
5560
extension RawRepresentable where Self: CodingKeyRepresentable , RawValue == Int {
5560
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5561
+ @available ( SwiftStdlib 5 . 6 , * )
5561
5562
public var codingKey : CodingKey {
5562
5563
_DictionaryCodingKey ( intValue: rawValue)
5563
5564
}
5564
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5565
+ @available ( SwiftStdlib 5 . 6 , * )
5565
5566
public init ? < T: CodingKey > ( codingKey: T ) {
5566
5567
if let intValue = codingKey. intValue {
5567
5568
self . init ( rawValue: intValue)
@@ -5571,13 +5572,13 @@ extension RawRepresentable where Self: CodingKeyRepresentable, RawValue == Int {
5571
5572
}
5572
5573
}
5573
5574
5574
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5575
+ @available ( SwiftStdlib 5 . 6 , * )
5575
5576
extension Int : CodingKeyRepresentable {
5576
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5577
+ @available ( SwiftStdlib 5 . 6 , * )
5577
5578
public var codingKey : CodingKey {
5578
5579
_DictionaryCodingKey ( intValue: self )
5579
5580
}
5580
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5581
+ @available ( SwiftStdlib 5 . 6 , * )
5581
5582
public init ? < T: CodingKey > ( codingKey: T ) {
5582
5583
if let intValue = codingKey. intValue {
5583
5584
self = intValue
@@ -5587,13 +5588,13 @@ extension Int: CodingKeyRepresentable {
5587
5588
}
5588
5589
}
5589
5590
5590
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5591
+ @available ( SwiftStdlib 5 . 6 , * )
5591
5592
extension String : CodingKeyRepresentable {
5592
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5593
+ @available ( SwiftStdlib 5 . 6 , * )
5593
5594
public var codingKey : CodingKey {
5594
5595
_DictionaryCodingKey ( stringValue: self )
5595
5596
}
5596
- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5597
+ @available ( SwiftStdlib 5 . 6 , * )
5597
5598
public init ? < T: CodingKey > ( codingKey: T ) {
5598
5599
self = codingKey. stringValue
5599
5600
}
@@ -5603,9 +5604,9 @@ extension Dictionary: Encodable where Key: Encodable, Value: Encodable {
5603
5604
/// Encodes the contents of this dictionary into the given encoder.
5604
5605
///
5605
5606
/// If the dictionary uses keys that are `String`, `Int`, or a type conforming
5606
- /// to `CodingKeyRepresentable`, the contents are encoded in a keyed container.
5607
- /// Otherwise, the contents are encoded as alternating key-value pairs in an
5608
- /// unkeyed container.
5607
+ /// to `CodingKeyRepresentable`, the contents are encoded in a keyed
5608
+ /// container. Otherwise, the contents are encoded as alternating key-value
5609
+ /// pairs in an unkeyed container.
5609
5610
///
5610
5611
/// This function throws an error if any values are invalid for the given
5611
5612
/// encoder's format.
@@ -5626,7 +5627,7 @@ extension Dictionary: Encodable where Key: Encodable, Value: Encodable {
5626
5627
let codingKey = _DictionaryCodingKey ( intValue: key as! Int )
5627
5628
try container. encode ( value, forKey: codingKey)
5628
5629
}
5629
- } else if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) ,
5630
+ } else if #available( SwiftStdlib 5 . 6 , * ) ,
5630
5631
Key . self is CodingKeyRepresentable . Type {
5631
5632
// Since the keys are CodingKeyRepresentable, we can use the `codingKey`
5632
5633
// to create `_DictionaryCodingKey` instances.
@@ -5690,7 +5691,7 @@ extension Dictionary: Decodable where Key: Decodable, Value: Decodable {
5690
5691
let value = try container. decode ( Value . self, forKey: key)
5691
5692
self [ key. intValue! as! Key ] = value
5692
5693
}
5693
- } else if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) ,
5694
+ } else if #available( SwiftStdlib 5 . 6 , * ) ,
5694
5695
let keyType = Key . self as? CodingKeyRepresentable . Type {
5695
5696
// The keys are CodingKeyRepresentable, so we should be able to expect
5696
5697
// a keyed container.
0 commit comments