Skip to content

Commit 1f8378b

Browse files
authored
Merge pull request #2104 from compnerd/superman
NSObject: use `_getSuperclass()` instead of a SPI
2 parents ddfac10 + 7b81178 commit 1f8378b

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

Foundation/NSObject.swift

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
// This brings it into line with Darwin usage for compatibility.
1313
@_exported import Dispatch
1414

15-
#if canImport(ObjectiveC)
16-
import ObjectiveC
17-
#else
18-
@_silgen_name("_swift_class_getSuperclass")
19-
internal func _swift_class_getSuperclass(_ t: AnyClass) -> AnyClass?
20-
#endif
21-
2215
import CoreFoundation
2316

2417
/// The `NSObjectProtocol` groups methods that are fundamental to all Foundation objects.
@@ -377,16 +370,7 @@ open class NSObject : NSObjectProtocol, Equatable, Hashable {
377370
// On Darwin, avoids dipping into the class hierarchy that exists above this class,
378371
// which is ultimately rooted in the ObjC NSObject class.
379372
guard !(self == NSObject.self) else { return nil }
380-
381-
let actualSuperclass: NSObject.Type
382-
383-
#if canImport(ObjectiveC)
384-
actualSuperclass = class_getSuperclass(self) as! NSObject.Type
385-
#else
386-
actualSuperclass = _swift_class_getSuperclass(self) as! NSObject.Type
387-
#endif
388-
389-
return actualSuperclass
373+
return _getSuperclass(self) as! NSObject.Type
390374
}
391375

392376
public class var superclass: AnyClass? {

0 commit comments

Comments
 (0)