Post

Replies

Boosts

Views

Activity

Enum with a description
Hi all, I would like to use Enum with a raw value and a short description e.g. enum DayOfTheWeek: String, CaseIterable, Identifiable{ var id: String {self.rawValue} case monday = "Monday" case tuesday = "Tuesday" for each day, I need to add short description, as a separate Text, e.g.: case monday = "Monday" var description = "it's a great day to have a coffee" I would like to be able to use for a Text field etc. is it possible or I am on the wrong track? I was thinking of an array or dictionary and make a reference to each element, but I think there must be a better way?
2
0
439
Dec ’22
JSON Core Data favorites
I am working on the project similar to SwiftUI tutorial - https://developer.apple.com/tutorials/swiftui . I have a "favourites" button done, but every time app restarts, list of marked items is gone. I understand Core Data is the way to go, but as each item (struct) has a lot of information attached (pictures, text etc.) and "favourite" is just one Bool. I am not sure how to use Core Data and not to overload it. Do I need to use Core Data to save every item with all information(pictures, text etc.) or just bool and some reference to e.g. "id"?
4
0
1.4k
Mar ’21