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

iOS Swift 2.0 Enumerations and Optionals Introduction to Enumerations Enums and Objects

I have no idea what is supposed to be returned in my switch statement to get the x or y coordinate to move.

I think I have everything in order except the part where I need to return something in each case. I've tried Point(x:0, y:0) and I get non-void return value in void function.

2 Answers

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

A robot has a property called location which is an instance of Point, which will mean that location has an x and a y property. The important thing to note is that you don't modify properties of Point, you modify properties of location.

                switch direction {
          case .Up: location.y++
          case .Down: location.y--
          case .Right: location.x++
          case .Left: location.x--
        }

Thanks!