Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this chapter, we're going to talk about the process of adding a new feature to our working code. After writing this application and submitting it to the App Store, I decided that I wanted to add a feature. I noticed that when I use the app, I would sometimes leave it for a while with the item view displayed, and after an hour so I would return, and I'd want to refresh the list to see what was new in that feed without having to return to the review and select the feed again. So, I decided to add a feature that would refresh the item view on demand. The first task when adding a feature is to think about how the user will use it.
What will the interface look like? One of the things I like about BW RSS is the interface is simple and uncluttered. I didn't want to add a button, especially on the iPhone platform with its limited screen space. Before iOS 6, there was no accepted gesture for reloading a page, so I opted to use the shake gesture. I'd seen it's done before, and I liked how it works, a gentle shake of the phone and the feed refreshes. Beginning with iOS 6, however, iOS now provides a pull to refresh feature, which is perfect for this purpose.
So here it is already implemented in the emulator. When I select a feed, I can pull and I get this little icon, and when I let go it refreshes. Well, there's nothing there. So I'm going to add a feed. This is a test feed that I've created. It's cleverly called Test Feed. It's at ios.bw.org/testfeed, and you're welcome to use this. In this feed, every time it gets called, it gives you five new items.
So when I refresh, I'll get five new items and these are random items. The source code for this feed is in Libraries, and it's in testfeed.py. It's a Python script, and this is the implementation of this test feed. It's not a very long script. It's about 150 lines long, and you're welcome to use it. Certainly, if you're going to be using this a lot, I'd rather that you would run it on your own server than on mine, but if you're just going to use it occasionally, you're welcome to run it on my server. And there's a lines.txt file here, which is used, has a bunch of little random disclaimers in it that I collected at one time in my life. Those are the headlines of these feeds.
Batteries not included, Penalty for private use, Some assembly required, et cetera. So that's the pull gesture. When you pull on it, it refreshes. And in the next movie, I'll show you how to implement the pull to refresh feature for iOS 6.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101038 Viewers
61 Video lessons · 87827 Viewers
71 Video lessons · 71703 Viewers
56 Video lessons · 103586 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Your file was successfully uploaded.