Programming in Swift · Challenge: Tuples | Ray Wenderlich


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5994-programming-in-swift/lessons/5

How did you open the character viewer?
I pressed Cmd-Ctrl-Spacebar but it opened the window away from Xcode, not exactly above it.
Is this only in Mojave? I’m in High Sierra.

Thank you

Just to satisfy my curiosity,
I changed the second challenge code as follows to check if nested tuple also works well.

let piDay2 = ((month: 3, day: 14, year: 1592), emoji: "🥧")
let ((_ , day2, _), emoji2) = piDay2

However, an error has occurred in the last assignment statement.

Cannot express tuple conversion ‘((month: Int, day: Int, year: Int), emoji: String)’ to ‘((Int, Int, Int), String)’

What’s the solution in this case?

I really appreciate any help you can provide.

@kingpin11 You should use the nested tuple’s labels to make the assignment:

let ((month: _, day: day2, year: _), emoji2) = piDay2

Please let me know if you have any questions or issues about the whole thing.

Thank you!

@notationmaster Do you still have this issue?

Well, yes, but I would not say it’s a problem, maybe it is just a difference in how High Sierra handles the special character window.
When I press cmd ctrl space I get the special character window but it doesn’t stem like a bubble from where I’m writing

Hi! Try clicking on the little box icon in the upper right corner. That should let you switch between the character viewer popping up above your cursor, or in a separate window.

07%20PM

oh you genius!!!
Thanks!

Merry Christmas and Happy New Year!

1 Like

How did you even get that menu do show up?

tsk