override func viewDidLoad() { super.viewDidLoad() let label = UILabel(frame: .zero) label.backgroundColor = .orange stackView.addArrangedSubview(label) switch searchViewModel?.state { case .loading: label.text = "loading" case .succeed: label.text = self.labelText case .failure: label.text = "failed" case .none: return } }
I want to update my label text according to my state. The labelText value I am getting from delegate callback method. The problem is I am using the value in viewDid Method, which is getting called only once. How can I solve the problem?
labelText
1.4m articles
1.4m replys
5 comments
57.0k users