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

Why doesn't this code challenge work? What exactly is the difference between declaring a custom type and a Double?

struct RGBColor { let red: Double let green: Double let blue: Double let alpha: Double

let description: String

// Add your code below




init(red: RGBColor, green: RGBColor, blue: RGBColor, alpha: RGBColor) {

    self.red = 86.0
    self.green = 191
    self.blue = 131.0
    self.alpha = 1.0
    self.description = "\(red) \(green) \(blue) \(alpha)"


}

}

1 Answer

Kenan Bateman
Kenan Bateman
16,715 Points

Hi Nate,

Not sure which code challenge this is, but I think the issue is you have an INT for the green value when it's expecting a Double value. If you change that to 191.0 it should compile