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