add conditional compilation

This commit is contained in:
John Estropia
2023-06-07 13:43:11 +09:00
parent 535b33ca75
commit 4b4ae61635

View File

@@ -114,8 +114,15 @@ extension NSManagedObject: DynamicObject {
}
public class func cs_fromRaw(object: NSManagedObject) -> Self {
#if swift(>=5.9)
return unsafeDowncast(object, to: self)
#else
// unsafeDowncast fails debug assertion starting Swift 5.2
return _unsafeUncheckedDowncast(object, to: self)
#endif
}
public static func cs_matches(object: NSManagedObject) -> Bool {