Post

Replies

Boosts

Views

Activity

Reply to SwiftData error: NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
This is still an issue for me in Xcode 15 RC. Below is an example of the transformer I'm using for saving a UIColor final class ColorValueTransformer: NSSecureUnarchiveFromDataTransformer { static let name = NSValueTransformerName(rawValue: String(describing: ColorValueTransformer.self)) override static var allowedTopLevelClasses: [AnyClass] { return [UIColor.self] } public static func register() { let transformer = ColorValueTransformer() ValueTransformer.setValueTransformer(transformer, forName: name) } }
Sep ’23
Reply to #Predicate doesn't work with enum
I am seeing the same behavior too...It doesn't seem to work with enums at all When I compare the enums I get the following in the console Query encountered an error: SwiftData.SwiftDataError(_error: SwiftData.SwiftDataError._Error.unsupportedPredicate) When i try to compare the enums using their raw value i get the following crash reffering to a file within the framework SwiftData/DataUtilities.swift:1140: Fatal error: Unexpected type for Expansion: Optional<UIColor> The UIColor is reffering to a color that i have as a transformable property It would be great if this was resolved before the GM release
Sep ’23
Reply to SwiftData @Query crashes when trying to filter or sort using an enum or relationship
So they do work when it comes to CRUD opertations. The issues that i’ve found is when you want to filter or sort i’m getting crashes. Also because my model uses transformable this is also causing a issues to. it’s almost as if the Query macro can’t handle this type. i’m going to try and see if it crashes using a FetchDescriptor. If it doesnt then that points me in the direction that Query doesn’t play nicely with custom types…
Sep ’23
Reply to SwiftData @Query crashes when trying to filter or sort using an enum or relationship
Ok a bit more info, so it seems that it's more related to the fact that SwiftData doesn't like filtering or sorting on optional values... Below is an example of me filtering based on a non optional string and the fetch request works let fetch = FetchDescriptor<Item>(predicate: #Predicate { $0.title == "G" }) let results = try? modelContext.fetch(fetch) print("Found \(results?.count) items") <--- This returns results that match the query When trying to filter and sort on optional properties like an enum or my property category this is where the issue arises... It seems to crash when trying to access the rawValue and also you get no results when you try to filter based on the case. Below is an example of be executing a query on an optional enum. let high: Priority = Priority.high let fetch = FetchDescriptor<Item>(predicate: #Predicate { $0.priority == high }) let results = try? modelContext.fetch(fetch) print("Found \(results?.count) items") <--- Returns nothing & accessing the raw value crashes... I hope someone on the Apple team sees this since it seems SwiftData and optionals just don't play nicely... This is on Xcode 15 RC
Sep ’23
Reply to Xcode 13.1 iOS 15.0 simulator missing location privacy settings
This seems to be an issue on simulators in Xcode 15+. The app settings location permissions appear on a real device, but not on any of the simulators. I did find a hack to make it appear and this was by requesting ATT permission this does show both the location & ATT permission. I’ve filled a feedback myself FB13330752 Below is my post with more info describing the issue. https://developer.apple.com/forums/thread/740598
Nov ’23