Post

Replies

Boosts

Views

Created

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
600
Dec ’22
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?
Replies
2
Boosts
0
Views
600
Activity
Dec ’22