0

I have a problem with passing data between View Controllers enter image description here

Now, to open Base Chat VC, from ConversationsVC I use

UINavigationController *chatNav = (UINavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"chatNav"];
[self.navigationController presentViewController:chatNav animated:YES completion:nil];

Where @"chatNav" is first navigation controller. I need pass data from ConversationsVC to Base Chat VC, I have no idea how to do it. If you have any idea, please help me. Thanks!

Vitalyz123
  • 189
  • 2
  • 10

1 Answers1

1

Don't pass the data at all.

Create an object outside your controller hierarchy to act as your data model. When your ConversationVC has new data, update your data model. When your BaseChatVC needs data, read it from your data model.

The data model implementation depends on the complexity of your data. It can be as simple as NSUserDefaults or as sophisticated as a wrapper for Core Data or server storage.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57