0

I'm trying to transfer data using protocol from this xib file called:OverlayPopUpView and it's of type UIViewController to another ViewController but I can't access access xib identifier in The another ViewController to transfer data like bellow :

if let OverlayPopUpVC = UIStoryboard(name: "Workstation", bundle:nil).instantiateViewController(identifier: "OverlayPopUpView") as? OverlayPopUpVc {
    
                OverlayPopUpVC.overlayPopUpDelegate = self
            
            }

but it gives me error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x6000029bb660>) doesn't contain a view controller with identifier 'OverlayPopUpView''

I guess the problem from here I can't access identifier of the xib file so I did it like that: accessibilityIdentifier of the nib file I wrote the key: accessibilityIdentifier of type string and wrote the value which I mentioned in the code above "OverlayPopUpView"

  • `.xib != .storyboard` . That's not how you init a VC from a xib, the code you use is how to init a VC from a storyboard: https://stackoverflow.com/questions/25513271/how-to-initialize-instantiate-a-custom-uiview-class-with-a-xib-file-in-swift – Larme Feb 13 '21 at 15:15
  • @Larme thank you can you show me the code please because I can't find an obvious answer in your link – abdallah eslah Feb 13 '21 at 15:24
  • https://stackoverflow.com/a/44675813/1801544 ? – Larme Feb 13 '21 at 15:25

0 Answers0