I'm so close here... I think I need to set my root VC as the delegate to the popover but I don't know how or even WHERE to do that. Storyboard: separate view controller, modal segue is dragged from menu item to VC. Popover works. I can get data from my textField, print it from popover's VC. Using a protocol / delegate method to get data back. Here is the code:
PopOver VC: //which is a delegate to it's textField as well.
Root VC:
it doesn't crash... but it's not bringing the data back thru the function. Any ideas? Thanks so much for your help.
PopOver VC: //which is a delegate to it's textField as well.
Code Block protocol ReturnFromPopover { func setStartTC(timecode: Timecode) // Timecode here is a special class I'm using } class EnterStartTCPopoverVC: NSViewController, NSTextFieldDelegate { var returnProtocol: ReturnFromPopover? func controlTextDidEndEditing(_ notification: Notification) { printTC(timecode: tempTC) // this works returnProtocol?.setStartTC(timecode: tempTC) dismiss(self) } }
Root VC:
Code Block class ViewController: NSViewController, NSPopoverDelegate, ReturnFromPopover { //instantiate a var called startTC func setStartTC(timecode: Timecode) { startTC = timecode print("it worked: \(startTC as Any)") } }
it doesn't crash... but it's not bringing the data back thru the function. Any ideas? Thanks so much for your help.