Silver challenge


#21

The text field placeholder and the “is really” label is hard to see at night. So i change their color depending one what time of day it is.

Also make sure you connect the new IBOutlet isReallyLabel. To do so open Main.storybaord and control-drag from “Convert” view controller to the “is really” text field and select the isReallyLabel under Outlets.

WARNING: I have not tested to see if the application is open while the time of day swaps.

@IBOutlet var isReallyLabel: UILabel!

override func viewWillAppear(animated: Bool) { let calendar = NSCalendar.currentCalendar() let hour = calendar.component(.Hour, fromDate: NSDate())

let lightColor = UIColor.init(red: 0.961, green: 0.957, blue: 0945, alpha: 1)
let darkColor = UIColor.init(red: 0.184, green: 0.184	, blue: 0.188, alpha: 1)


	
switch hour {
case 8...18:
	isReallyLabel.textColor = UIColor.blackColor()
	view.backgroundColor = lightColor
default:
	let string = NSAttributedString(string: "Value", attributes: [NSForegroundColorAttributeName: UIColor.whiteColor()])
	textField.attributedPlaceholder = string
	isReallyLabel.textColor = UIColor.whiteColor()
	view.backgroundColor = darkColor
}
}

#22

Taking AZcoder reply, I have updated the time based solution to Swift 3;

    override func viewWillAppear(_ animated: Bool) {
    
    let date = Date()
    let calendar = Calendar.current
    let hour = calendar.component(.hour, from: date)
    
    let dayColor = UIColor(red:1.00, green:1.00, blue:1.00, alpha:1.0)
    let nightColor = UIColor(red:0.50, green:0.50, blue:0.50, alpha:1.0)
    
    if hour >= 8 && hour <= 20 {
        self.view.backgroundColor = dayColor
    } else {
        self.view.backgroundColor = nightColor
    }

#23

Hi, thanks for the detailed hints for how to find different pertinent info in order to solve the problem. I appreciate that you went through the time to write out the process so other programmers can find other solutions using similar steps.

I noticed that some of your text is missing, for whatever reason. For example, after “That leaves:”, “skip down to the section:”," Another option: In Xcode, type:", and “A third option: In Xcode type:” it seems that there should be some text, but it’s not visible (to me at least- I’m on my laptop).