This is my code in VC1
I have this var user = User()
in VC1 that has all the data.
func handleMessageView() {
let layout = UICollectionViewFlowLayout()
let messageViewController = MessageViewController(collectionViewLayout: layout)
messageViewController.user = user
let messageNavController = UINavigationController(rootViewController: messageViewController)
self.present(messageNavController, animated: true, completion: nil)
}
This is called by a UIBarbutton.
in VC2 I just have a recieving var. var user = User()
This var is returning a nil, Im not using storyboard nor xib. This is all programmatic.