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 trialJonathan Boisvert
4,582 Pointsim so lost what am i Doing wrong
I see that the structure defines constants and values and the description outputs a string from that but where do the numbers get inputed and how does it return the statement?
struct RGBColor {
let red: Double
let green: Double
let blue: Double
let alpha: Double
let description: String
// Add your code below
init (red: Double, green: Double, blue: Double, alpha: Double) {
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
self.description = ("red: \(86.0), green: \(191.0), blue: \(131.0), alpha:\(1.0)")
}
}
3 Answers
Jonathan Fernandez
4,047 PointsVery close! The values the challenge gives are not meant to be directly implemented into your init method. The idea is to make your code dynamic, which you can do by passing replacing 86.0 with red, and 191.0 with green, and so on. Where these values are referring to the argument values passed in when init method is called.
Max F
9,900 PointsThe fields get inputted where you create the RGBColor object.
Jonathan Boisvert
4,582 Pointsi tried that once I will try it twice