Post

Replies

Boosts

Views

Activity

Comment on SwiftUI SwiftData Previews not working as expected
@lucaszischka Works for me in beta 5. I use as reference the code here "https://developer.apple.com/videos/play/wwdc2023/10154/?time=564" (min 9:05), without the problem of main actor. So, I define MainActor PreviewContainer (like video) and in #Preview I have only ".modelContainer(previewContainer)" under View and use the solution of this topic for pass a preview static Item
Aug ’23
Comment on Stop using MVVM for SwiftUI
Hi @azamsharp, sorry but I don't understand how this respond to my question. Your solution is valid when you create in a view a new object and after manipulate it you call save. What happens in edit, considering that SwiftData autosaves changes? What happens, If user edit BudgetCategory and change the name? How do you check that name already exists? Also, if for example you need to call another function only if the user confirms a change to the budget amount, how do you handle that?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24