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
2.1m questions
2.1m answers
60 comments
57.0k users