swift - UILabel Value of type 'String' have no member 'text' (Static Custom Cell) -
i'm getting user information json when assign values labels, shows error (value of type 'string' have no member 'text')
.
is because custom static table cell? how fix it? foundation not good...
use different variable names. practise have unique variable names
as variable names same variable values getting error
uilabel has name empnamelabel : uilabel
(in viewdidload
) , value has same name.
change
let empnamelabel = user!["crew_name"] as? string //conflicting name uilabel iboutlet
to
let empnamevalue = user!["crew_name"] as? string //variable name unique
also should not force unwrap options(user
in case)
it should
var empnamevalue = "" if let unwrappeduser = user { if let empnamevalue = unwrappeduser["crew_name"] as? string { empnamelabel.text = empnamevalue //assign value uilabel } }
Comments
Post a Comment