Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
MIK Agency
22,496 PointsEnumeration in swift
I was watching stanford university course for iOS when suddenly...
https://www.youtube.com/watch?v=OJUsghbtbF8 around 11:00 he starts creating an enum like this:
enum Op {
case Operand(Double)
case UnaryOperation(String, Double -> Double)
case BinaryOperation(String, (Double, Double) -> Double)
}
Can someone please explain why he used types like those doubles, and a function inside an enum.
Please use as much examples as possible, that usually helps a lot.
Thank you!