I have a func writeSomethingInTextField(textfield: String) -> String, should change a value of var in class, but it doesn't, change var only temporary in func. Anyone know where is the problem?
class OperationsManagment {
var TextField: String = ""
func writeSomethingInTextField(textfield: String) -> String {
if textfield == "" {
print("you have to write something here")
return "nil"
}else {
self.TextField = textfield
return self.TextField
}
}
func sendTextField() {
print("\(TextField)")
}
}
OperationsManagment().writeSomethingInTextField(textfield: "exampleText")
OperationsManagment().sendtextField()