I am trying to get the text from the text field I have created inside my stackview but I am not able to do it. I was wondering if anyone could help me with this.
for example what I am trying to do is this: when I press a button Label.text = myTextField.text.
This is my code:
var mySttackView: UIStackView = {
//NAMETEXTFIELD
let myTextField = UITextField() //<---- want to get the text from this when I press a button but I can't get access to it
myTextField.translatesAutoresizingMaskIntoConstraints = false
myTextField.placeholder = "MY TEXT"
let theStackview: UIStackView = UIStackView(arrangedSubviews: [myTextField])
theStackview.axis = .vertical
theStackview.translatesAutoresizingMaskIntoConstraints = false
theStackview.distribution = .fillEqually
theStackview.spacing = 12
return allTextFields
}()