3

Im trying to pass an array between two VC. I understand how we are suppose to pass data forwards and backwards using segue, but for a tab bar controller you would have to pass data forwards and backwards? My storyboard flows like this Tab bar controller -> VC1/ VC2 im trying to pass data from VC1 to VC2, more specifically an array.

Eric Aya
  • 69,000
  • 34
  • 174
  • 243
Valerio Zhang
  • 488
  • 8
  • 24
  • here's a concise example to share data across controllers using a singleton Swift class: https://stackoverflow.com/a/44380145/2162226 – Gene Bo Jul 19 '17 at 21:03
  • [related answer](https://stackoverflow.com/a/47751962/3681880) – Suragch Dec 11 '17 at 11:35

1 Answers1

2

Have a look at this question: iPhone: How to Pass Data Between Several Viewcontrollers in a Tabbar App

Also the imho cleanest way is to use the NSNotificationcenter. It's simple: How to use NSNotificationcenter

Community
  • 1
  • 1
  • thanks, I knew other people would have similar problems but I couldnt find any good answers from so via google or recommendations. – Valerio Zhang Aug 31 '16 at 15:53