Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How do I limit what my jSon returns?

I'm writing a iOS blog reader app in Swift. I'm using a wordpress site to house the info, everything works fine but the wordpress is returning way to many posts when I call http://techwelike.com/api/get_recent_summary/ it's giving me 70 back, is there any way I can limit this to like 25 at most. As you all can guess it's making my app load super slow, lol. I even tried loading the jSon in background thread and nope still slow lol. Please help Amit Bijlani

2 Answers

Hello Marlon.

I could be wrong but, you should be able to limit your request inside the request itself.

//For example: 
let urlString = "https://itunes.apple.com/us/rss/topmovies/limit=25/json"

StackOverflow

Thanks Aaron Ackerman I guess I will try that, but the thing is this http://techwelike.com/api/get_recent_summary/ gives me back 71 results while http://sophisticatedignorance.net/api/get_recent_summary/ gives me back 10.