struct Weather{
var city :String?
var temp :String?
var weather :String?
}
class ViewController: UIViewController {
@IBOutlet weak var labelWeather: UILabel!
@IBOutlet weak var labelCity: UILabel!
@IBOutlet weak var labelTemp: UILabel!
var weatherData :Weather?{
didSet{
confView()
}
}
func confView(){
labelCity.text = self.weatherData?.city
}
}
I'm a swift beginner. The function named confView( ) is called by weatherData before the declaration statement. Is it right? The xCode didn't report an error. But i think "func confView()"should be placed before "var weatherData". Is it necessary?