Posts

Post not yet marked as solved
0 Replies
485 Views
How do I perform a search using SwiftData within an observable data model For example: If I have a database of books that contains the property isbn, how would I perform a search to confirm I either had or did not have a book with the isbn I am searching for? Using CoreData I use a fetch request: let predicate = NSPredicate(format: "%K == %@", #keyPath(Book.isbn), isbn) let fetchRequest: NSFetchRequest<Book> = Book.fetchRequest() ... let book = try context.fetch(fetchRequest). // returns [book] use isEmpty for not found. ... if book.isEmpty { saveBook() } I have a number of queries I perform on the database to drive the logic within the app, this is just one example.
Posted
by t-j-c.
Last updated
.
Post not yet marked as solved
5 Replies
3.0k Views
GPX exchange no longer works. When selecting a gpx file, all gpx files are greyed out. This was working fine before, and in fact my project has a gpx file it was using to simulate gps and this was working and now no longer is listed as a location to simulate. This is hampering my development.
Posted
by t-j-c.
Last updated
.
Post not yet marked as solved
1 Replies
562 Views
For simplicity when storing arrays of Int, Double, or Date I placed [Int], or [Double], or [Date] in the Attribute custom class field (see screenshot), however when the app compiles the following error is shown: Misconfigured Property: Entity.timestamp is using a nil or insecure value transformer. Please switch to NSSecureUnarchiveFromDataTransformerName or a custom NSValueTransformer subclass of NSSecureUnarchiveFromDataTransformer Does this mean that Apple will be dropping this feature, i.e. the option of adding arrays this way will be removed, or if they update their code will the data in my database be unreadable? What is best practice of storing large data arrays in core data?
Posted
by t-j-c.
Last updated
.