Going through the examples in this chapter, I get an error when using sets.
When declare a set such as let emptySetOfFloats = Set<Float>()
I get an error. The error reads “Use of unresolved identifier ‘Set’.”
Anyone else getting this? I am not copy/pasting from the ebook and I carefully typed the line several times, and slowly. Weird!
That’s very unusual. I just double checked in a new playground and it worked fine. Have you tried quitting Xcode, or perhaps creating a fresh playground to see if it has gotten confused?
Hi Adam,
Thanks for responding.
I did try quitting and reopening Xcode, and it seemed to clear the error, but it would not show the result on the right. Retyping the line would produce the error again. At one point, I think the playground compiler did get confused, as Xcode suggested quitting and reopening the file!
I did manage to fix the issue though. I was using Xcode 6.2, which must have had some issues with playgrounds in it. Upgrading to the latest (6.3.2) has resolved this for me.
Thanks!
Ah yes – Set was added in Swift 1.2/Xcode 6.3.