Unlike enums, option sets don’t know how to print themselves. (It’s brand new in 2.0 for enums, so give option sets some time.) Here’s my favorite workaround from today. You see it in line 7. It’s beautiful because this for-in-where enumerates, filters, transforms, and collects all at the same time.
3 Comments
I like that enumerate. It lets you use the simpler loop and still have a numeric index. No need to choose between them.
Where did you find the reference for the “for…where” syntax? I can’t find it anywhere
oh nevermind, just found on the “what’s new in swift” video https://developer.apple.com/videos/wwdc/2015/?id=106