So I'm trying to make a simple Numeral System Converter, so I need to get a string variable from a Text Field. Or so was my solution thus far.
Thing is, when I try to do so it gives me that error.
The involved code right now is:
@IBOutlet weak var Numero: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
Numero.delegate = self
// Do any additional setup after loading the view.
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
Numero.resignFirstResponder()
}
var num: String = Numero.text
// Cannot use instance member 'Numero' within property initializer; property initializers run before 'self' is available //
I don't quite understand what's wrong. After watching a couple tutorials, they all use the same format with no errors.
What could be my mistake?