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 Enums and Structs Enums Enum Members and Raw Values

Alistair Ridley
Alistair Ridley
4,521 Points

how do i assign the raw value to this member?

stage 1 enums

enum.swift
enum Speed: Int {case Slow = 10, Medium = 50, Fast = 100}
if var turtleSpeed = Speed(rawValue: 10){
turtleSpeed(Slow)}

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Alistair,

The challenge is simply asking for you to retrieve the rawValue which is a property on each case within the enum, next it's asking for you to assign it to a variable, see the below.

var turtleSpeed = Speed.Slow.rawValue

Happy coding and Merry Christmas.

Alistair Ridley
Alistair Ridley
4,521 Points

You Sir are Awesome!

Merry Christmas!!!