Is there a way to define an enum, when initialized from rawValuerawValue will default to some value instead of failing? Useful in cases where the value may be unexpected (i.e. server API errors)
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal Is there a way to define an enum, when initialized from rawValuerawValue will default to some value instead of failing? Useful in cases where the value may be unexpected (i.e. server API errors)
Is there a way to define an enum, when initialized from rawValue will default to some value instead of failing? Useful in cases where the value may be unexpected (i.e. server API errors)
Is there a way to define an enum, when initialized from rawValue will default to some value instead of failing? Useful in cases where the value may be unexpected (i.e. server API errors)