ios - Passing user data through view controllers -


this question has answer here:

i'm making basic app allows user login.

i wanted know general practice of passing user data between view controllers. after user authenticated, acceptable pass data through view controllers?

for example, user logged in , authenticated. user wants "create event", able save user hosting event, have store users id on event host , need access uid. save users id after login , keep passing in every view?

i using firebase backend if helps.

you should learn thing called "segues". primary mechanism transition between views in ios.

here's tutorial(no personal affiliation, btw) http://makeapppie.com/2014/07/01/swift-swift-using-segues-and-delegates-in-navigation-controllers-part-1-the-template/

haven't used firebase, if passing event data scratch 4 things.

  1. would declare var in target controller.
  2. in source controller fire off function: performseguewithidentifier @ appropriate time.
  3. that takes prepareforsegue function (the contents of func last point of no return before transition new controller). inside, create var name of type name of target view controller.
  4. use dot operators access variable want pass , give appropriate value

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -