You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm going through exercises in episode 12: Tagged and I don't know how to accomplish the last one:
Create Unvalidated and Validated tagged types so that you can create a function that takes an Unvalidated and returns an Optional<Validated> given a valid user. A valid user may be one with a non-empty name and an email that contains an @.
I don't like the ergonomics of this code - the rawValue is everywhere. When I want to access validated user data I have to call the rawValue for each field.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm going through exercises in episode 12: Tagged and I don't know how to accomplish the last one:
I ended up with this:
I don't like the ergonomics of this code - the
rawValue
is everywhere. When I want to access validated user data I have to call therawValue
for each field.Can anyone help me with this?
Beta Was this translation helpful? Give feedback.
All reactions