Skip to content

Formatting fields into correct form #36

Answered by robfeldmann
DavidKmn asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is because map by itself isn't enough for parsing and printing. You will have to define how to go both ways.

There's a special conversation you can use. Something like:

.map(.convert(
  apply: {
    // for parsing
    $0.uppercased()
  },
  unapply: {
    // for printing
    $0.lowercased()
}
))

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by DavidKmn
Comment options

You must be logged in to vote
1 reply
@DavidKmn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants