Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active February 20, 2022 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdev/2abea571b37be824f2cac5c03fb3c353 to your computer and use it in GitHub Desktop.
Save jasdev/2abea571b37be824f2cac5c03fb3c353 to your computer and use it in GitHub Desktop.
Dictionary merging with shorthand argument names.
tabGroup1
.merging(tabGroup2, uniquingKeysWith: { $0 }) // ❌ “Contextual closure type `(Tab, Tab) throws -> Tab`
// expects 2 arguments, but 1 was used in closure body.”
tabGroup1
.merging(tabGroup2, uniquingKeysWith: { $1 }) // Referencing the second of the two-argument closure compiles fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment