Skip to content

Instantly share code, notes, and snippets.

@blixt
Last active February 2, 2016 23:32
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 blixt/440699fb7db718aaba89 to your computer and use it in GitHub Desktop.
Save blixt/440699fb7db718aaba89 to your computer and use it in GitHub Desktop.
Swift segfaulting
struct Participant {
let identifiers: [(label: String?, value: String)]
}
// This segfaults. Combining the two maps or changing "" to nil works.
let participants = ["a", "b", "c"]
.map { ("", $0) }
.map { Participant(identifiers: [$0]) }
// Update: Here's an error from a later build of Swift which explains the error.
<REPL Input>:1:85: error: cannot express tuple conversion '(String, String)' to '(label: String?, value: String)' (aka '(label: Optional<String>, value: String)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment