O'Reilly logo

iOS 8 SDK Development, 2nd Edition by Janie Clayton, Chris Adamson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sharing Data Between View Controllers

Now that we can get the selected tweet, we need a way to communicate between the view controllers. Actually, our tweet detail view controller may want more information than we have in the ParsedTweet, or things that the home_timeline API doesn’t even provide, so we’ll need a way to pass the tweet’s unique identifier to the second view controller, and then let that view controller get whatever details it needs via a new Twitter API call.

So, add a tweetIdString to ParsedTweet.swift:

Navigation/PragmaticTweets-9-2/PragmaticTweets/ParsedTweet.swift
 
var​ tweetIdString : String?

In the Twitter API response, the tweet’s unique ID string is identified with the key id_str, so that’s what we need to get from the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required