Programming in Swift · Methods | Ray Wenderlich

That’s exactly it. :+1:

Sometimes, you’ll want a type only to group constants and/or methods. You could use a class, or a struct, but if you’ll never need to instantiate the type for any purpose, then a caseless enumeration is the clearest choice that Swift offers.

1 Like

I’ve loved this course so far. It’s helped me solidify concepts I’ve struggled with in the past. That being said…

Slow down, please. I’m getting way too confused by this example, and you’re moving on to steps 3, 4, and 5 without explaining the “why” of step 1 and 2.

I keep reminding myself that we are supposed to be talking about methods. If it takes longer to explain your example scenario than to explain the point of the lesson, that might mean the example is a bit too convoluted.

PS - I’ve never heard of UInt until today. I could (and will) google it to figure it out, but that’s time I could have spent learning about Methods, as the title of the lesson suggests it is teaching.

1 Like

Thanks for the feedback!

We’ve restructured this course this year. The new episodes specifically on methods aren’t ready yet, but methods are touched on starting in the new Structures episode. If you get a chance, we’d love to know if you’re happy with the changes.

As for UInt, the U stands for “Unsigned”. i.e. There is no information about positivity/negativity built-in; only positive numbers can be represented. Otherwise it’s virtually the same as Int; Int just has half the magnitude because one bit of its storage has to be taken up with the +/- representation.

Thanks for this information. It is very useful

2 Likes