@@ -39,6 +39,22 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
39
39
40
40
return NSGeneratorEnumerator ( _storage. keys. map { _SwiftValue. fetch ( nonOptional: $0) } . makeIterator ( ) )
41
41
}
42
+ @available ( * , deprecated)
43
+ public convenience init ? ( contentsOfFile path: String ) {
44
+ self . init ( contentsOfURL: URL ( fileURLWithPath: path) )
45
+ }
46
+
47
+ @available ( * , deprecated)
48
+ public convenience init ? ( contentsOfURL url: URL ) {
49
+ do {
50
+ guard let plistDoc = try ? Data ( contentsOf: url) else { return nil }
51
+ let plistDict = try PropertyListSerialization . propertyList ( from: plistDoc, options: [ ] , format: nil ) as? Dictionary < AnyHashable , Any >
52
+ guard let plistDictionary = plistDict else { return nil }
53
+ self . init ( dictionary: plistDictionary)
54
+ } catch {
55
+ return nil
56
+ }
57
+ }
42
58
43
59
public override convenience init ( ) {
44
60
self . init ( objects: [ ] , forKeys: [ ] , count: 0 )
@@ -583,20 +599,6 @@ open class NSMutableDictionary : NSDictionary {
583
599
super. init ( objects: objects, forKeys: keys, count: cnt)
584
600
}
585
601
586
- public convenience init ? ( contentsOfFile path: String ) {
587
- self . init ( contentsOfURL: URL ( fileURLWithPath: path) )
588
- }
589
-
590
- public convenience init ? ( contentsOfURL url: URL ) {
591
- do {
592
- guard let plistDoc = try ? Data ( contentsOf: url) else { return nil }
593
- let plistDict = try PropertyListSerialization . propertyList ( from: plistDoc, options: [ ] , format: nil ) as? Dictionary < AnyHashable , Any >
594
- guard let plistDictionary = plistDict else { return nil }
595
- self . init ( dictionary: plistDictionary)
596
- } catch {
597
- return nil
598
- }
599
- }
600
602
}
601
603
602
604
extension NSMutableDictionary {
0 commit comments