12
12
@_silgen_name ( " swift_getTypeContextDescriptor " )
13
13
private func _getTypeContextDescriptor( of cls: AnyClass ) -> UnsafeRawPointer
14
14
15
- open class Bundle: NSObject {
16
- private var _bundleStorage : AnyObject !
17
- private final var _bundle : CFBundle ! {
18
- get { unsafeBitCast ( _bundleStorage, to: CFBundle ? . self) }
19
- set { _bundleStorage = newValue }
15
+ open class Bundle : NSObject , @unchecked Sendable {
16
+ private let _bundleStorage : AnyObject !
17
+ private var _bundle : CFBundle ! {
18
+ unsafeBitCast ( _bundleStorage, to: CFBundle ? . self)
20
19
}
21
20
22
21
public static var _supportsFHSBundles : Bool {
@@ -82,13 +81,11 @@ open class Bundle: NSObject {
82
81
}
83
82
84
83
internal init ( cfBundle: CFBundle ) {
84
+ _bundleStorage = cfBundle
85
85
super. init ( )
86
- _bundle = cfBundle
87
86
}
88
87
89
88
public init ? ( path: String ) {
90
- super. init ( )
91
-
92
89
// TODO: We do not yet resolve symlinks, but we must for compatibility
93
90
// let resolvedPath = path._nsObject.stringByResolvingSymlinksInPath
94
91
let resolvedPath = path
@@ -101,6 +98,8 @@ open class Bundle: NSObject {
101
98
if ( _bundleStorage == nil ) {
102
99
return nil
103
100
}
101
+
102
+ super. init ( )
104
103
}
105
104
106
105
public convenience init ? ( url: URL ) {
@@ -134,13 +133,12 @@ open class Bundle: NSObject {
134
133
}
135
134
136
135
public init ? ( identifier: String ) {
137
- super. init ( )
138
-
139
136
guard let result = CFBundleGetBundleWithIdentifier ( identifier. _cfObject) else {
140
137
return nil
141
138
}
142
139
143
- _bundle = result
140
+ _bundleStorage = result
141
+ super. init ( )
144
142
}
145
143
146
144
public convenience init ? ( _executableURL: URL ) {
0 commit comments