Created by: Jeff Verkoeyen (github.com/jverkoey && @featherless)
Three20 technologies used:
- TTNavigator - AppDelegate.m
- TTTableViewController - TTTwitterSearchFeedViewController.m
- TTTableViewDragRefreshDelegate - TTTwitterSearchFeedViewController.m
- TTURLRequestModel - TTTwitterSearchFeedModel.h/m
- TTURLRequest - TTTwitterSearchFeedModel.m
- TTURLXMLResponse - TTTwitterSearchFeedModel.m
- TTListDataSource - TTTwitterSearchFeedDataSource.h/m
- TTStyledText - TTTwitterSearchFeedDataSource.m
- TTTableStyledTextItem - TTTwitterSearchFeedDataSource.m
The Twitter example project covers the basics of building a native feed-based iPhone application. This app pulls data from the search.twitter.com feed with the query "three20" and displays the result in a table view.
Drag-to-refresh header, as seen in other apps. Simply pull down on the table view to refresh the feed. Thanks to uprise78 for this great addition to the Three20 library!
Atlas.h/m - This is where all of the app's navigator routings will go. By placing the URL paths in a central location, we can easily change the URL routings without fear of breaking the app's navigation hierarchy.
AppDelegate.h/m - This is a simple shell for initializing the TTNavigator routes. Nothing crazy going on here.
TTTwitterSearchFeedViewController.h/m - This is where the magic happens in this app. We do two important things here. First, we create the data source. Second, we create a TTTableViewDragRefreshDelegate. The second step is what enables the drag-to-refresh header. Simple, eh?
TTTwitterSearchFeedModel.h/m - The model is what loads the data. In this case we're using a TTURLRequestModel, which is a model that loads its data from a URL request. Before we fire off the request, we also attach the response object, a TTURLXMLResponse, which receives the resulting data and processes it. The Three20 XML parser is incredibly leightweight and simply transforms the XML text into NSObjects. Upon receiving the response, we then enumerate the feed items and create tweets from the objects.
TTTwitterSearchFeedDataSource.h/m - The data source binds the controller to the model. We create the model here as well as defining the text that is displayed when errors occur, or when there aren't any results from the model. When the model completes loading, we take the resulting data and create the table items.