swift - UIImage showing nil even after initialize it -
i declared uiimage variable :
var s1:uiimage? = uiimage(named: "alphabet o")
i assigning image in method:
func setimage(){ if var img = s1{ img = uiimage(named: "alphabet x")! } }
the answer can quite simple new in swift. please help. thanks