Post

Replies

Boosts

Views

Activity

Reply to How to GROUP and SORT fetched core data, and create a List in order?
Yes, I posted a new quesiton, but don't know why you couldn't see it, so I tried to ask you again here. Any other method can reach you directly?Please search for this topic: Update SwiftUI View after updating core data value with toggle buttonI can change and update the core data record by clicking the button, but the main problem is the updated record (backend) cannot be reflected immediately in the DetailView, after clicking in some case. However, when I go back to ListView, and click to open DetailView again, it's actually there. Any method to refresh the View, to reflect the updated record instantly?Thanks.
Mar ’20
Reply to How to GROUP and SORT fetched core data, and create a List in order?
In SwiftUI, I have a simple core data entity, and one of the attributes called "finished" (Bool).I fetch the core data to create a List in ListView. When I click an item of the List, it goes to the DetailView, which includes the record "finished".In the DetailView, I added a toggle button to SHOW the value of "finished", and meanwhile I use this toggle button to UPDATE the record of "finished" in core data.The curent problem is I can use this toggle button to CHANGE the record in core data; however, the result CANNOT be updated immediately in DeailView. (That means, when I go back to ListView, I see it's updated. And when I click the item and go to DetailView, the record's also properly shown.)1) How to fix this issue? What's the best way to do it?2) What's the proper way to assign the core data value of "finished" to the toggle button, when DetailView's launched?Thanks
Mar ’20
Reply to SwiftUI List performane
I have the similar problem.I have a simple core data (one of the attributes called "finished" (Bool) ), and I use the data to make a List ("ListView").When click the items on the List, it goes to a Detail List ("DetailView").On the Detail List, I have a button to SHOW the status of "finished", and UPDATE its record in core data. I can use it to change and update the record successfully.When I click the toggle button, at backend, the record's updated.However, the main problem is it cannot reflect the changes in Detail List. Can I REFRESH / RELOAD the Detail List? How to do it? What's the best way to do this task?Many thanks!
Mar ’20
Reply to How to GROUP and SORT fetched core data, and create a List in order?
I tried to apply your function to the Section part of my List:List { ForEach((group(songs)), id: \.self) { (section: [Songs]) in Text(section[0].singer!)} }I got the same result (i.e. Sections go arbitrarily), but I don't know the actual reason. Is there any problem for my codes in the List? I cound't get the result that I want.I'm very new to Swfit. If you can, please give me some explanation for your codes. 🙂I'm really grateful for your time and help!
Mar ’20