Post

Replies

Boosts

Views

Activity

Reply to SwiftData fatal error "Never access a full future backing data"
Had similar issue when trying to delete a model Instance which has a one-to-many relationship (Deleting a Collection that holds multiple Items). What I did is the following: Initialize the ModuleContainer as below. struct MyApp: App { private var sharedModelContainer: ModelContainer = { let schema = Schema([ Collection.self, Item.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { let container = try ModelContainer(for: schema, configurations: [modelConfiguration]) container.mainContext.autosaveEnabled = false return container } catch { fatalError("Could not create ModelContainer: \(error)") } }() // PROPERTIES @State private var container: ModelContainer // INITIALIZATION init() { self.container = sharedModelContainer } //MARK: - VIEW var body: some Scene { WindowGroup { RootView(modelContext: container.mainContext) } .modelContainer(container) } } Make sure the child Model has the inverse relationship & the parent is Optional @Model class Item { @Attribute(.unique) var id: UUID var creationDate: Date var name: String var quantity: Int var frequency: String var intervalDays: Int var packed: Bool // Parent @Relationship var collection: Collection? And it worked for me. Let me know if this hint helped. Thank you!
Topic: UI Frameworks SubTopic: General Tags:
Jan ’25
Reply to How to determine the default duration of a long-press
As per today, Apple does not provide third-party apps with access to customize the press duration for the onLongPressGesture modifier. As a workaround, you might allow users to adjust the press length in your app's settings to cater to their preferences. It would indeed be helpful if Apple made the default press duration for onLongPressGesture align with the user's accessibility settings. However, this seems like a rare use case, as most users likely stick with the default value, making it less critical to address. 🤷‍♂️
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’25