Skip to content

Commit

Permalink
add conditional compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnEstropia committed Jun 7, 2023
1 parent 535b33c commit 4b4ae61
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/DynamicObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4b4ae61

Please sign in to comment.