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 trialEddie Aguilar
2,393 PointsA bit confused as to what to input
not to sure what to input into this section. I guess I'm getting confused because I do not have a viewController to go off of. What do i type to make this pass??
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
1 Answer
Jaroslaw Adamowicz
11,634 PointsHi,
in this challange you have class with two methods inside.
Your first task is to add new property. Class property can be variable or constant named blueColor, so either:
let blueColor = UIColor.blue
or
var blueColor = UIColor.blue
You can always use more advanced way of course using UIColor initializer directly, like this for example:
var blueColor = UIColor(red:0, green:0, blue:255, alpha:1.0)
Just keep in mind, one of this lines should be added somewhere inside of the ViewController class, but not inside of the methods!
Your second task is to use this property to change background of the view inside ViewController. Remember, view is literally a property of ViewController!
Also you one to do this in method called viewDidLoad. This method should be self-explanatory, IOS calls this method when your view is ready and load, so you can now customize it (like change its background) :D
So it will look like this:
view.backgroundColor = blueColor
That's all to it!
Let me know if you still need some help.
Cheers!
BR, Jarek