Last active
November 16, 2025 02:55
-
-
Save juanarzola/c5c2268b88840ec4bc6f0be2a053b2bb to your computer and use it in GitHub Desktop.
An extension that normally works, except from shortcuts, where uuid isn't found in the schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension FetchDescriptor { | |
| public static func model<Model: PersistentModel & UUIDString>( | |
| withUUIDString uuidString: String? | |
| ) -> FetchDescriptor<Model> { | |
| guard let uuidString else { return .init(predicate: .false) } | |
| let pred = #Predicate<Model> { $0.uuid == uuidString } | |
| var desc = FetchDescriptor<Model>(predicate: pred) | |
| desc.fetchLimit = 1 | |
| return desc | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error (on AppIntents, running on Release):