Hey guys, my problem:
I have to different VC's with textFields, and I need their text on the third ViewController, I use a two protocols to push the textfield text as data to the third VC.
Here are the two Protocols:
I implemented the variables in the two vc's and afterwards I tested the functionality with print statements, it worked! Now I need them in the third VC, this is my code yet but it throws the following error: force unwrapped a nil value
The third VC:
I hope someone can help me! Thanks in advance
I have to different VC's with textFields, and I need their text on the third ViewController, I use a two protocols to push the textfield text as data to the third VC.
Here are the two Protocols:
Code Block protocol RegisterNameProtocol { var name: String? { get set } } protocol RegisterNumberProtocol { var phoneNumber: String? { get set } }
I implemented the variables in the two vc's and afterwards I tested the functionality with print statements, it worked! Now I need them in the third VC, this is my code yet but it throws the following error: force unwrapped a nil value
The third VC:
Code Block weak var nameDelegate: RegisterNameProtocol? weak var phoneDelegate: RegisterNumberProtocol? var phoneNumber = "" var name = "" func xyzzy() { phoneNumber = (phoneDelegate?.phoneNumber)! name = (nameDelegate?.name)! }
I hope someone can help me! Thanks in advance