UIView viewwithtag method in swift
You need to use a typecast. This code will do it:
if let theLabel = self.view.viewWithTag(123) as? UILabel {
theLabel.text = "some text"
}
You need to write as
var getMyLabel : UILabel = self.view.viewWithTag(tagValue) as UILabel;
viewWithTag: returns a UIView, you need to typecast it to UILabel
.
var yourLabel : UILabel = yourView.viewWithTag(yourTag) as! UILabel;