I have been trying a challenge out alone in Swift to do programmatically - with no use of storyboards.
My first view controller has a label and a button to go to the second view controller.
I created a navigation controller within the app delegate
file, and then push to the second view controller when the button is pressed.
The second view controller has a textfield, a button to save the text, and a button to go back to the first view controller.
The UI is fine, but I cannot figure out how to save the text that is entered into the textfield which is on the second view controller, and then display this text in the label in the first view controller.
Can someone give me a clue as to how to do this?
Currently in my button going back to the first view controller I have this:
func handleBackToVC1() {
self.navigationController?.popViewController(animated: true)
}
Is this where I pass the data that is in the textfield and display it in the label? Also, should I give the label some text to start off with? But which would then get changed to what was entered into the textfield?